Do you really need to determine free local port? By what you wrote it doesn't seem you need that.
You need a free local port if you are making a server type of application, not a client application. If you connect to remote server (then you are making a client application) you connect to whatever port that server has assigned but that will not generate "TCP binding error" on your (client) computer. Usually you connect to specific port then the communication continues after establishing connection on a random port to free the specific port on server for additional connections. If you really need free local port for server app, then assign a port, start server and if you get an exception, assign another port and so on until you exhaust all ports required for your application. If you need one specific port - then report error to the user. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be