|
-
Nov 1st, 2000, 11:39 PM
#8
Going in the wrong direction ....
KnlgHt,
You need to know the basic working of control arrays for using a single winsock control to accept more than one connection.
The MSDN has the necessary code for you, I shall outline what I did in my sample Client-Server program.
Put a winsock control on your form, which will act as the server. Name it tcpServer and it will have the index as 0.
Now remember one thing. You need to put this control i.e. tcpServer(0) in the Listening mode. tcpServer(0) will always stay in the listen mode. Whenever it receives a new connection request, it loads a new winsock into the array and passes on the request to this new winsock control. Remember, tcpServer(0) should never accept the connection request by itself. The connection request must be accepted by another control in the array.
Then you need to have a variable to track the index of the last winsock in the array. Every time you receive a new connection request on tcpServer(0), you increase this variable by 1 and that's the index of the new winsock.
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
|