Listing and identifying sockets. the ss command may be used to display the listening connections and the established connections on a machine. Suppose you see the sample output shown below. Netid State Local Addr:Port Peer Addr:Port Users udp UNCONN 0.0.0.0:8003 0.0.0.0:* (pid=29604,fd=3) tcp LISTEN 0.0.0.0:8003 0.0.0.0:* (pid=28832,fd=3) Netid State Local Addr:Port Peer Addr:Port Users tcp ESTAB 127.0.0.1:8003 127.0.0.1:47468 (pid=28832,fd=4) tcp ESTAB 127.0.0.1:47468 127.0.0.1:8003 (pid=29910,fd=3) The output above lists all the connections on the machine where the ss command is run. Helpfully, the last column of the output, entitled Users, also shows the process ID (pid) of the application process associated with the socket and the number of the file descriptor (fd) associated with the socket. (a) Suppose a TCP packet enters the machine, destined to TCP port 8003 corresponding to an established connection. Can you identify the pid and socket fd, if any, corresponding to the socket where this packet is demuxed to? (b) Suppose a TCP packet enters the machine, destined to TCP port 8003, corresponding to a fresh connection just being initiated by a client through a connect() call. Can you identify the pid and socket fd, if any, corresponding to the socket where this packet is demuxed to? Suppose a TCP packet enters the machine, destined to TCP port 47468, corresponding to a fresh connection being made by a client through the connect() call. Will this client’s connect() succeed? Why or why not? Suppose a UDP packet enters the machine, destined to UDP port 8003. Can you identify the pid and socket fd, if any, corresponding to the socket where this packet is demuxed to?
Listing and identifying sockets. the ss command
may be used to display the listening connections and the established connections on a machine.
Suppose you see the sample output shown below.
Netid State Local Addr:Port Peer Addr:Port Users
udp UNCONN 0.0.0.0:8003 0.0.0.0:* (pid=29604,fd=3)
tcp LISTEN 0.0.0.0:8003 0.0.0.0:* (pid=28832,fd=3)
Netid State Local Addr:Port Peer Addr:Port Users
tcp ESTAB 127.0.0.1:8003 127.0.0.1:47468 (pid=28832,fd=4)
tcp ESTAB 127.0.0.1:47468 127.0.0.1:8003 (pid=29910,fd=3)
The output above lists all the connections on the machine where the ss command is run. Helpfully,
the last column of the output, entitled Users, also shows the process ID (pid) of the application
process associated with the socket and the number of the file descriptor (fd) associated with
the socket.
(a) Suppose a TCP packet enters the machine, destined to TCP port 8003 corresponding to
an established connection. Can you identify the pid and socket fd, if any, corresponding to the
socket where this packet is demuxed to?
(b) Suppose a TCP packet enters the machine, destined to TCP port 8003, corresponding to a
fresh connection just being initiated by a client through a connect() call. Can you identify the
pid and socket fd, if any, corresponding to the socket where this packet is demuxed to?
Suppose a TCP packet enters the machine, destined to TCP port 47468, corresponding
to a fresh connection being made by a client through the connect() call. Will this client’s
connect() succeed? Why or why not?
Suppose a UDP packet enters the machine, destined to UDP port 8003. Can you identify
the pid and socket fd, if any, corresponding to the socket where this packet is demuxed to?
Step by step
Solved in 2 steps