|
-
October 12th, 2001, 07:10 AM
#1
SOS : Accepting multiple connections using Winsock
I am using Winsock control in my application with TCP protocol. It is supposed to accept more than one client request. The problem is i am able to accept only one ConnectRequest. What do i need to do inorder to accept more than one client requests. I am following the hints given in MSDN exactly, but i feel i am doing something terribly wrong somewhere.
Thanks in advance,
Vivek ([email protected] or [email protected])
-
October 12th, 2001, 08:32 AM
#2
Re: SOS : Accepting multiple connections using Winsock
You will need to use a control array or winsock controls. What I always do is create one winsock (sckListen) which I use to listen for incoming connection, and a control array (sckAccept) to accept the actual connctions. You will need to add 1 sckAccept, and give it index 0. Code looks something like this:
Code:
private iCnn as Integer
private Sub Form_Load()
sckListen.LocalPort = 1024
sckListen.Listen
Msgbox "Socket listening"
End Sub
private Sub sckListen_ConnectionRequest(RequestID as Long)
iCnn = iCnn + 1
Load sckAccept(iCnn)
sckAccept(iCnn).Accept RequestID
End Sub
private Sub sckAccept_DataArrival(Index as Integer, byval bytesTotal as Long)
Msgbox "someone is sending something over connection " & Index
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
Last edited by Cimperiali; May 1st, 2003 at 02:21 PM.
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
|