If UDP does not establish a connection as TCP does.. it seems the only way it could track connections is source ip/port and destination ip/port. Is this correct?
So, I guess there are special packets for Connection Refused and Connection Reset. Is that correct?
Also, is it true that my data may not be received in the order it was sent?
Your first para is correct. There is no connection, though some IP engines use source address/port and destination address/port to provide a synchronicity-based approximation to state.
Refusal is handled with ICMP, often ICMP port-unreachable (type 3 subtype 3).
Your last para is also correct; it's up to your application to ensure that UDP-transmitted data is correctly sequenced.
There is no
connection
in UDP. It is not a reliable protocol. If transmission reliability is desired, it must be implemented in the user's application. Have a look at this page.Yes, packets may arrive out of order and may be lost. The application should take care of these things if needed.
UDP is also known as the unreliable data protocol. There is no tracking as such in UDP. You could use src and dst IP/Port combo for tracking but not sure what you would achieve out of it.
The answer to your second question, that data may not be received in order it was sent it, is correct. TCP uses the sequence numbers. If a packet is received out of sequence it is discarded. The client sends a acknowledgement to sender of the sequenced packet received, upon which the sender starts sending data from that point onwards. This could also include retransmission of some packets. This is how TCP provides data guarantee.
UDP is a datagram-oriented service. Each UDP packet should have (ideally!) its full context in the packet, as packets can be lost or re-ordered in transit.
TCP, on the other hand, is a stream-oriented protocol, providing a bi-directional stream between two end-points (this implies reliability and sequencing, whereas a datagram service doesn't, necessarily).