multiple client server

cyclonebri
11-19-2001, 02:46 PM
I am trying to set up a multiple client server with a winsock control array...I set up the connection request like this:

Private Sub sckServer_ConnectionRequest(index As Integer, ByVal requestID As Long)
If index = 0 Then
intMax = intMax + 1
Load sckServer(intMax)
sckServer(intMax).LocalPort = 0
sckServer(intMax).Accept requestID
End If
End Sub

And then the problem hits in the sckServer_DataArrival event,
when it loads, it says :
Procedure declaration does not match description of event or procedure having the same name.

here is the code I have in the dataArrival method:
Private Sub sckServer_DataArrival(index As Integer, bytesTotal As Long)
Dim strIN As String
On Error Resume Next

sckServer(index).GetData strIN

End Sub

Can anyone tell me what I'm doing wrong?
Thanks,
Brian

Banjo
11-19-2001, 03:09 PM
It should be:

Private Sub sckServer_DataArrival(index As Integer, ByVal bytesTotal As Long)

cyclonebri
11-19-2001, 03:48 PM
Thank you very much, that was the problem.

I have another problem now that maybe you can help me with.

I am able to accept data from two different sockets, but I can only send data to the last socket that logged onto the server, it's as if the socket is now gone for transmission purposes. Here is my code for transmission:

If (KeyCode = vbKeyReturn And Not (ShiftDown)) Then
' If the user pressed <enter> without the shift key, then attempt to
' send the message.
For index = 1 To intMax
' Send the message
sckServer(index).SendData txtOutgoing.Text
' Add the message to the server's history window
AddToHistory "Server: " & txtOutgoing.Text
Next index
End If

***note, this shows up twice in the server window, but only once in the client window...

Do you know what I'm doing wrong with this?

Banjo
11-19-2001, 06:07 PM
That looks OK. The only thing I would suggest is to put a DoEvents after the send. It allows the control time to actually send the data. This makes it easier to debug it interactively with the client program.

cyclonebri
11-20-2001, 07:47 AM
Thanks again, as soon as I put the DoEvents in the code, the server was able to keep up and now can send the information to all the clients. Thank you very much for all your help!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum