|
-
September 10th, 2001, 05:12 AM
#1
Connecting with WinSock
Hello
How can I connect more then two users with winsock. ??? (like in chat)
Thanks
-
September 10th, 2001, 05:38 AM
#2
Re: Connecting with WinSock
The thing you need to do is to make a control array. Doing this at run-time is very flexible, and can serve up to as many connections as your system is capable of (read as hardware restrictions). To do this, place one Winsock control on teh form, give it index 0. When a connection request comes in, create a socket, and accept the connection.
private ConnectionCount as Integer
private Sub Winsock1_ConnectionRequest(Index as integer, RequestID as long)
ConnectionCount = ConnectionCount + 1
Load Winsock1(ConnectionCount)
Winsock1(ConnectionCount).Accept RequestID
End Sub
private Sub Winsock1_DataArrival(Index as integer, .....
Dim strData as string
Winsock1(Index).GetData strData
Msgbox "incoming data from connection " & Index & vbcrlf & strData
End Sub
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
September 10th, 2001, 05:51 AM
#3
Re: Connecting with WinSock
what Cakkie said is right
but to get a clear idea u can go to
planetsourcecode.com
there u will find many chat projects
i hope there u will get what u want
best of luck
-
September 10th, 2001, 06:42 AM
#4
Re: Connecting with WinSock
What I do with the LocalPort and RemotePort ?
Can I use same ports for all clients ?
-
September 10th, 2001, 07:39 AM
#5
Re: Connecting with WinSock
Oops, forgot, you need to set the localport. Typically, start counting from a number, and add the ConnectionCount to it. Do this before you issue the Accept method.
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
September 10th, 2001, 08:11 AM
#6
Re: Connecting with WinSock
I found.
Thanks.
I use with same port for all users
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|