Forum Home
Press F1
 
Thread ID: 61543 2005-09-08 10:37:00 VB6, Winsock dwnz (5333) Press F1
Post ID Timestamp Content User
386922 2005-09-08 10:37:00 Hey
I am trying to make a multiplayer game, and are using the Winsock control, but all i recieve at the other end is ???????????????, yet i have created other programs that work with the winsock 100%.

Heres the Connection request code

Private Sub ws_ConnectionRequest(Index As Integer, ByVal requestID As Long)
Load ws(conc) 'Loads a new winsock
If ws(conc).State <> 0 Then ws(conc).Close 'Checks the state
ws(conc).Accept requestID 'Accepts it
DoEvents 'Finishes computing it
conc = conc + 1 'Adds a count on
frmMenu.List1.AddItem "Player 2 has joined. Press start when ready"
End Sub

Heres the send loop

Private Sub ws_DataArrival(Index As Integer, ByVal bytesTotal As Long)
ws(Index).GetData buffer 'Downloads the data into the buffer

Debug.Print buffer

For i = 1 To ws.UBound 'Starts a loop
ws(i).SendData buffer 'Sends the data
DoEvents
Next i

buffer = "" 'Clears the buffer
End Sub

Client part

Private Sub ws_DataArrival(ByVal bytesTotal As Long)
Dim buffer
ws.GetData buffer

If xml.selectSingleNode("//Game/Player").Text = "1" Then
Car1.Top = xml.selectSingleNode("//Game/Top").Text
Else
Car2.Top = xml.selectSingleNode("//Game/Top").Text
End If

End Sub

i assume its something to do with this part of the code, but im not 100% sure. Is there something im doing wrong?

Cheers
Daniel
dwnz (5333)
386923 2005-09-08 10:38:00 Sorry about the layout, Pressf1 didnt like the tabs dwnz (5333)
1