hello!
anybody can help me? i want to send my data to all clients and test if its match then close the client but i cannot figure out why it is no sending.
'==== server side ====
Code:Private Sub cmdPC_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
cmdPC(Index).SetFocus
sClientName = cmdPC(Index).Caption
PopupMenu mnu
End If
End Sub
'**** this is my problem
Private Sub mnuClose_Click()
Dim i As Integer
For i = 1 To iSockets
If Socket(i).State = sckConnected Then
Socket(i).SendData sClientName
cmdPC(i).Enabled = False
Else
MsgBox "client is not connected"
End If
Next
End Sub
Private Sub socket_ConnectionRequest(Index As Integer, ByVal requestID As Long)
On Error GoTo err
sServerMsg = "Connection request id " & requestID & " from " & Socket(Index).RemoteHostIP
'If Index = 0 Then
List1.AddItem (sServerMsg)
sRequestID = requestID
iSockets = iSockets + 1
lblConnections.Caption = iSockets
Load Socket(iSockets)
'Load Socket(Socket.UBound + 1)
Socket(iSockets).LocalPort = 1007
Socket(iSockets).Accept requestID
Label1.Caption = ""
Exit Sub
err:
iSockets = iSockets - 1
Label1.Caption = err.Description + "-" + sClientName
'==== client side ====
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
Winsock1.GetData sData, vbString
'Label1.Caption = sData
txtPrice.Text = sData
Label3.Caption = "Received Data"
shpGo.Visible = True
shpWait.Visible = False
shpError.Visible = False
If sData = txtName.Text Then
End
ElseIf sData = "Disconnected" Then
Winsock1.Close
Label4.Caption = "Disconnected"
End If
End Sub
