I'm trying to verify my understanding of how the ports work here for both UDP and TCP (I think I know how TCP works, but definately not UDP). Assume this is the TCP session. Client ip =, Web Server ip =

Client initiates connection to the web server

Client sends SYN to Server. src IP= dst IP=

Server sends SYN ACK to Client. src IP= dst IP=

Client sends ACK to Server. src IP= dst IP=


I believe the above is correct. But now, I would like someone to explain this exact process for UDP (I appreciate there is not a 3 way handshake), but how do the src/dst port's work with UDP. Is it simply this?

Client sends DNS query to server

Client's connection  =  src IP= dst IP=

Server's connection =  src IP=2.2.2:src_port_53 dst IP=


  • That is correct.

    Just to add something. TCP connection has 2 endpoints. When TCP server starts (For example) it has one endpoint with localIP=serverIP, localport=serverport, remoteIP=*,remoteport=*. When client connects to server, server creates new endpoint with local IP address as server IP and local port as server port and remote IP as client IP and remote port as client port. This is done for each new client connecting to this server IP:port.

    But in case of UDP, when client sends data to server, server does not create new endpoint. It uses its started endpoint with localIP=serverIP, localport=serverport, remoteIP=*, remotePort=*.

Sign In or Register to comment.