In a VB6 Application, I am looking for a way to determine the Local Port for the duplex socket.
I have the remote Ip and Port, but I need to know an print out the local port as well.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just query the Winsock control’s LocalPort property.
The LocalPort property is used both to set the send/listen port and to retrieve it once the connection has been established. Even if you specify port 0, in which case the control will select a random port, after a connection is established, this property will contain that port number.