This preview shows page 1. Sign up to view the full content.
Unformatted text preview: art different servers at the same port, each with a different local IP address.
Normally, however, the system must be told by the application that it is OK to reuse the same
With the sockets API the SO_REUSEADDR socket option must be specified. This is done by our
sock program by specifying the -A option.
On our host sun we can start five different servers on the same UDP port (8888):
sun % sock -u -s 126.96.36.199 8888
sun % sock -u -s -A 188.8.131.52
sun % sock -u -s -A 127.0.0.1 8888 for SLIP link
for loopback interface file:///D|/Documents%20and%20Settings/bigini/Doc...omenet2run/tcpip/tcp-ip-illustrated/udp_user.htm (25 of 29) [12/09/2001 14.46.58] Chapter 11. UDP: User Datagram Protocol sun % sock -u -s -A 184.108.40.206
sun % sock -u -s -A 8888 everything
else (wildcard IP address) for Ethernet broadcasts All except the first of the servers must be started with the -A flag, telling the system that it's OK
to reuse the same port number. The netstat output shows the five servers: Proto Recv-Q Send-Q udp
Local Address (state) In this scenario, the only datagrams that will go to the server with the wildcarded local IP
address are those destined to 220.127.116.11, because the other four servers cover all other
There is a priority implied when an end point with a wildcard address exists. An end point with
a specific IP address that matches the destination IP address is always chosen over a wildcard.
The wildcard end point is used only when a specific match is not found.
Restricting Foreign IP Address
In all the netstat output that we showed earlier, the foreign IP address and foreign port
number are shown as *.* meaning the end point will accept an incoming UDP datagram from
any IP address and any port number. Most implementations allow a UDP end point to restrict
the foreign address.
This means the end point will onl...
View Full Document
- Spring '12