Winsock Visual Basic Question
Posted on 2014-04-13
I have a Visual Basic 6 application that I'm writing to connect to two remote micro-controllers. The micro controllers each have their own IP addresses and ports. My laptop application has two Winsock controls in a form that I connect and try to read/write data to each controller. Both controllers are Arduino Ethernets and are programmed to be servers. My application on my laptop is programmed to connect to each using "sckTCPProtocol".
Controller 1: Winsock1 192.168.1.100 port 11010
Controller 2: Winsock2 192.168.1.101 port 11011
In my Visual Basic application, I make the connections on loading the app, then I have a timer that I placed the winsock.sendData command in such that I intend to "sendData" periodically to Winsock1 and Winsock2. Unfortunately, I can't seem to send data to both at the same time. Both connect but I can't send data to both when running in the same application. I can comment one and send to the other and vice versa. But I can't send data to both in the application. I've tried closing one connection and alternating but that doesn't work. I don't want to run two separate executables.
Private Sub Timer1_Timer()
If Not Winsock2.State = sckConnected Then
If Not Winsock1.State = sckConnected Then
Any suggestions? Definitely need help on this one.