This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 777:
sun % sock -u -s 7777
We then use the netstat command to see the state of the end point:
sun % netstat -a -n -f inet
Active Internet connections (including servers)
Local Address Foreign Address (state)
We have deleted many lines of output other than the one in which we're interested. The -a flag
reports on all network end points. The -n flag prints IP addresses as dotted-decimal numbers, file:///D|/Documents%20and%20Settings/bigini/Doc...omenet2run/tcpip/tcp-ip-illustrated/udp_user.htm (24 of 29) [12/09/2001 14.46.58] Chapter 11. UDP: User Datagram Protocol instead of trying to use the DNS to convert the address to a name, and prints numeric port
numbers instead of service names. The -f inet option reports only TCP and UDP end points.
The local address is printed as *.7777 where the asterisk means the local IP address has been
When the server creates its end point it can specify one of the host's local IP addresses,
including one of its broadcast addresses, as the local IP address for the end point. Incoming
UDP datagrams will then be passed to this end point only if the destination IP address matches
the specified local address. With our sock program, if we specify an IP address before the port
number, that IP address becomes the local IP address for the end point. For example,
sun % sock -u -s 220.127.116.11 7777
restricts the server to datagrams arriving on the SLIP interface (18.104.22.168). The netstat
output shows this: Proto Recv-Q Send-Q udp 0 0 Foreign
22.214.171.124.7777 *.* Local Address (state) If we try to send this server a datagram from a host on the Ethernet, bsdi at address
126.96.36.199, an ICMP port unreachable is returned. The server never sees the datagram.
Figure 11.21 shows this scenario.
(0.0008) bsdi.1723 > sun.7777: udp 13
sun > bsdi: icmp: sun udp port 7777
unreachable Figure 11.21 Rejection of UDP datagram caused by server's local address binding.
It is possible to st...
View Full Document
- Spring '12