|
-
May 25th, 2005, 09:09 AM
#1
Thread Starter
New Member
help me with winsock
Hello everybody
I'm a new member in this forum and I have good information in vb6
now my problem in the winsock tool
and my Q. is : How I can allow 2 clients to connect to 1 server in the same time ?
please help me .
yours
-
May 25th, 2005, 09:30 AM
#2
Re: help me with winsock
Welcome to the forums magic_net.
Have a look at the attached zip file in this thread. Although the example is for a chat room, it does address the issues of using Winsock with multiple people.
In addition, there are a wide number of past posts concerning Winsock that you may find useful. If you click on the Search button, and type in winsock, you will get a listing of them all.
I hope this helps.
-
May 25th, 2005, 12:06 PM
#3
Thread Starter
New Member
Re: help me with winsock
thanx hack
I'll try the file
-
May 25th, 2005, 12:45 PM
#4
Re: help me with winsock
Hey magic,
Hack my guide is only a basic 1 on 1 chat program 
But to transform it to a mulituser is very simple, you have to have a control array of winsocks to do this. (So copy and paste the winsock in the server side) now then we need to change a few routines within the server, note the client does not change.
VB Code:
Private Sub winsock_DataArrival(ByVal bytesTotal As Long)
'we will change this to
Private Sub winsock_DataArrival(Index as integer, ByVal bytesTotal As Long)
we will also need to change the code in this sub slightly
VB Code:
winsock.getdata
'would change to
winsock(Index).getdata
Also not here if your server gets data from a specific client normal practice is that the server then sends this to every other client who is connected, to do that the follwoing code is used...
VB Code:
Winsock(Index).getdata data
for i = 0 to winsock.ubound - 1
if winsock.sckconnected = true then
winsock(I).senddata data
end if
doevents
next i
Theres one last sub we need to change and thats the conntion request event
Change to the following (Not there are much better ways memory wise to do this but for beggining purposes this does the job!)
VB Code:
Private Sub Winsock_ConnectionRequest(Index As Integer, ByVal RequestID As Long)
Load Winsock(Winsock.UBound + 1)
Winsock(Winsock.UBound).Accept RequestID
End Sub
Hope that helps, i've just written it blind and its a while since I've played with some winsock so hope that helps you 
Pino
Edit - hack is correct I forgot there was another user mentioning how to make it multi-user
Bah all my typing is worthless
-
May 25th, 2005, 12:53 PM
#5
Re: help me with winsock
 Originally Posted by Pino
Edit - hack is correct I forgot there was another user mentioning how to make it multi-user
Bah all my typing is worthless 
I was gonna say...I know these old eyes ain't what they used to be, but I could have sworn there was multiuser code in there.
-
May 25th, 2005, 12:55 PM
#6
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
|