I've had a topic like this before, and numerous Winsock problems. I feel like I know what I am doing, and clearly when something works once it shant work again!
Anywho, I've been doing some more progress on my project. Here are a couple of examples of working senddata:
Here is where I am having a problem:Code:Case "move" For i = 0 To lstUsers.ListCount - 1 If lstUsers.List(i) = ParamData(0) Then UserIndex = i Exit For End If Next lstX.List(UserIndex) = ParamData(1) lstY.List(UserIndex) = ParamData(2) lstAction.AddItem "move: " & ParamData(0) & " to " & ParamData(1) & "," & ParamData(2) For i = ws.lbound To ws.Ubound SendCommand "move", ParamData(0) & "," & ParamData(1) & "," & ParamData(2), i Next i Case "chat" lstChat.AddItem "[" & ParamData(0) & "] " & ParamData(1), 0 For i = ws.lbound To ws.Ubound SendCommand "chat", ParamData(0) & "," & ParamData(1), i Next i
My SendCommand function:Code:Case "map" If rsMysql.State = adStateOpen Then rsMysql.Close End If MsgBox CommandData(0) & "," & CommandData(1) rsMysql.Open "SELECT * FROM maps WHERE id = '" & CommandData(1) & "'", cnMysql, adOpenForwardOnly, adLockReadOnly, adCmdText If rsMysql.RecordCount > 0 Then Dim strMap As String, strTemp As String, curStep As Integer: strMap = rsMysql.Fields(2).Value & "end" Do While Len(strMap) > 0 curStep = curStep + 1 If Len(strMap) < 100 Then strTemp = strMap strMap = Replace(strMap, strTemp, "") Else strTemp = Left$(strMap, 100) strMap = Replace(strMap, strTemp, "") End If SendCommand "map", strTemp & "," & curStep, i Loop Else SendCommand "map", "Error!", i End If
The receiving end is not getting anything, and I have done lots of checking on this. After the senddata, I had an SendComplete sub put up a MsgBox when the data was sent. It worked for the first two cases I showed you, but with this case it did not show. Is there something simple I am just overlooking?Code:Private Sub SendCommand(sCommand As String, params As String, Index As Integer) If ws(Index).State = sckConnected Then ws(Index).SendData sCommand & "|" & params & "¶" End If End Sub
<3Your Winsock nub,
thejurm





Reply With Quote