Link to home
Start Free TrialLog in
Avatar of RETAILREALM
RETAILREALMFlag for United States of America

asked on

Win sock connect with multiple port

Hi
We are using Winsock control to connect to external program whose  ip address let’s say 192.168.1.1
Now we need to talk with that control on port 25000
This is fine as we are connected to the same port

    TCPClient.RemoteHost = "192.168.1.1"
    TCPClient.RemotePort = 25000
   TCPClient.Connect

But at the same time external programmer is broadcasting some messages on port 25001 , how can we listen to that port ( we don’t need to send data to this port only listen ) using the same winsock or there is any other method.
Avatar of VBClassicGuy
VBClassicGuy
Flag of United States of America image

I do the same thing in my programs. You will need an array of WinSocks, not just one. A WinSock can only service one port number at a time. In the WinSocks's DataArrival event, you can then use the Index parameter to decide what to do with the data.
Avatar of RETAILREALM

ASKER

Hi

Thanks for your reply

Can you please explain this  , as we are still not able to do so , even after doing control array
ASKER CERTIFIED SOLUTION
Avatar of VBClassicGuy
VBClassicGuy
Flag of United States of America 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