Click here to Skip to main content
15,745,750 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

Can anybody provide me a link or article on using multiple socket connection using winsock control in vb6.


I got how to use socket connection.
Now i have a problem.

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

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.


Updated 17-May-11 2:30am
Sandeep Mewara 17-May-11 3:15am    
Did you try to find yourself? Google?

God, I feel so filthy doing this. CLick this[^] and start reading.

Supporting VB6 in any way, shape, or form leaves me needing a shower. I just cannot accept, at all, why ANYONE is still writing code in VB6. It's long dead and unsupported. Oh, and you won't find support for the VB6 runtime in Windows 8.
Share this answer
Simply add another Winsock control and listen to it. You say "Broadcasting" so it's probably on UDP and on the network's broadcast address so be sure you have your subnet calculated correctly. For a /24 subnet, the last octet will be .255. Save it in a variable called NetworkBroadcastAddress$. Similarly, store the client computer's address in MyIP$ . Then, if your second socket is called TCPClient2, this should work for you to and listen for UDP broadcasts on 25001.
With TCPClient2
        .LocalIP = NetworkBroadcastAddress$
        .Protocol = sckUDPProtocol
        .Bind 25001, MyIP$ 
        If .State = sckListening Then
            Msgbox "Listening on Socket " & .LocalPort 
            Msgbox "Deaf !"
        End If
End With
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900