Link to home
Start Free TrialLog in
Avatar of bfeddish
bfeddishFlag for United States of America

asked on

Issue using MS Winsock control in VB6


I have a VB 6 app that recieves data from another machine. Right now I can recieve data the machine is sending and send back an Ack to the sending machines port number. The issue is I want to use another port number to send the ack to the sending machine.  Doing something like this tcpServer.RemotePort = 3000 does not work since I cannot change the remote port number while the connection is open. I tried to close the current connection then open a scond one (second winsock control on the form but when it hits the TCPserver2.Connect statement it fails with "Address already in use" even thuogh I have closed the previous connection.
Avatar of Mark_FreeSoftware
Mark_FreeSoftware
Flag of Netherlands image


you should add a delay because the other computer has to respond to your connection close
ASKER CERTIFIED SOLUTION
Avatar of jkaios
jkaios
Flag of Marshall Islands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
... Your remote machine (server) just sits and listens for incoming connections on port 3000, but when sending/receiving ACK to/from
"client" machines, must be on a different port.  This is to keep the listening port (3000) open for any new incoming connections.

In this way, the server can accept multiple connections simultaneously.