ADC Home > Reference Library > Technical Q&As > Legacy Documents > Networking >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Unbinding from a TCP Port


Q: After unbinding from a TCP port, I am sometimes unable to do anything with that port until I reboot. This happens in both native OpenTransport API and MacTCP emulation. What gives?

A: OpenTranport TCP makes that port busy for a period of time long enough (about 2 minutes) for any remote connections to time out before you can bind to it again. This is done to prevent any stale connections from corrupting new ones.

You will notice that even though your next OTBind to that port was successful, the address returned wasn't what you asked for, because of the lag. The X/Open spec states that you have to explicitly check the address returned.

Although a MacTCP emulation should return a duplicateSocket error, on some older version of OT it doesn't; you should check the address returned when using MacTCP, too.

The bottom line is: always check your returned address.

If you are using the native Open Transport API, there is a way around the two-minute delay. You can issue an option management call before you do the bind to enable the IP_REUSEADDR option.

Be aware, though, that with the IP_REUSEADDR option, at most only one endpoint in an unconnected state (i.e., listening) may be bound to a port. There may be more endpoints, however, already connected or closing, which are bound to the same port.

See X/OpenTransport Interface for further documentation.

[Nov 01 1995]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.