I have a VB application where winsock is used. I want to convert it to VB.Net, so as I understand I should use System.net.sockets to do this.
But the problem is in the VB application multiple sockets are created by using the index feature of the winsock . example
Load Socket(isocket)
where isocket is an integer variable that is incremented each time, for a new connection request.
So how do I do the same, ie. open multiple sockets in vb.net?
In VB6 the Winsock is an OCX so what you are doing by calling
Load Socket(Index)is creating a new instance of the ActiveX Control. There is no such equivalent in VB.NET so what you could do is create a collection of System.Net.Sockets.Socket:When you get a new connection request, create a new item in the collection:
Then you can access your sockets by Index (zero based):