Dear all,

I am building a client server application using Winsock control.
Based on that I have the following code part on server side which try to
connect to the first based port and if not scan to the next free on on a
range of 10:

For iPortNumber = ServerInfo.ListenPort To ServerInfo.ListenPort + 10
DoEvents
tcp.LocalPort = iPortNumber
On Error Resume Next
tcp.Listen ' If we get an error, the port is busy.
If Err.Number = 10048 Then ' port is busy
Else
ServerInfo.ListenPort = iPortNumber
ServerInfo.bRunning = True
Exit Function
End If

tcp.Close
Next iPortNumber

What happen next is that the client side application need to know what is
the communication port that has been selected by the server.

Is there a way that the server informed about the client about that port
number ?

For the client side, it used the based port number but as the server has
notify that it was used then the client point to the wrong port tio initiate
a communication.

Thansk for your help
Regards

CALDERARA Serge
Maillefer S:A