...

View Full Version : vb socket programming quick question



thegreatone2176
11-20-2004, 10:11 PM
I searched the forums and didnt find anything so heres my question...

I have made a chat client in vb using sockets but the problem its only allowing one connection at a time.... i tried making an array to store the connected ips but that didnt work.

Is the a special sock.<function> for allowing mutilple connections

Thanks!

Dunna
11-29-2004, 10:31 PM
I have had the exact same question for a while. I write a chat program but couldn't figure it out, then tried allocating winsock objects in an array, but found it to difficult to manage. My final solution was to give up. Just joking! So far though, haven't had much luck. You could use the Winsock array, but I don't know how to write individual handlers for operations like DataArrival. I was wondering if there was a way to dynamically declare functions and subs and objects in vb, because this would solve the problem. If it's possible, the code might look something like:
Private Sub Winsock(i)_DataArrival(bytes as integer)
...
...
End sub

I don't think this is legal coding though! I hope this helped somewhat. If not, maybe you should consider switching it over to C++, in which case all your problems are solved!

dw5304
12-01-2004, 12:07 AM
what are you trying to connect to? is it on a network or accoss th web? if it is across the net work set one computer on the network just for handeling the connectoins in a diffent socket. Have a server socket and a client socket. server for listing for new connections on ports and the client for chating on the ports

Dunna
12-01-2004, 12:38 PM
what are you trying to connect to? is it on a network or accoss th web? if it is across the net work set one computer on the network just for handeling the connectoins in a diffent socket. Have a server socket and a client socket. server for listing for new connections on ports and the client for chating on the ports

First off, with vb you can use the web or network with a TCP/IP Winsock object, which is one nice thing about it. You can also use the same socket to receive and send messages, so a server and client socket is pointless. You are only allowed one connection per socket, which is the main problem.

dw5304
12-04-2004, 12:49 AM
not 100% true i have net network over here haveing roughly 400 computer runing on my chat client all connecting on one port: 6653 it handles it varry well.

aman
12-04-2004, 03:34 AM
port is completely different than socket.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum