Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21990

Multi-User Chat Server - Not sending data back to all clients.. CODE included

$
0
0
Can anyone out there please tell me what the heck is going on here.. When i fire up two clients to test, and type on either one, they only see there own text... i.e. ClientA only sees what Client A types, and Client B only sees Client B text.

Code:

Option Explicit
Private Socks As Integer

Private Sub cmdCheck_Click()
MsgBox Winsock1(0).State
End Sub

Private Sub cmdStart_Click()
Winsock1(0).Close
Winsock1(0).Listen
lblStatus.Caption = "Default Room Server: Running!"
End Sub

Private Sub cmdStop_Click()
Winsock1(0).Close
lblStatus.Caption = "Default Room Server: Stopped!"
End Sub

Private Sub Form_Unload(Cancel As Integer)
End
End Sub

Private Sub Winsock1_ConnectionRequest(Index As Integer, ByVal requestID As Long)
Socks = Socks + 1
Load Winsock1(Socks)
Winsock1(Socks).Accept requestID
End Sub

Private Sub Winsock1_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim strdata As String
Dim intCnt As Integer
Winsock1(Index).GetData strdata, vbString
For intCnt = 1 To Socks
    If Winsock1(Index).State = sckConnected Then
        Winsock1(Index).SendData strdata
    End If
Next intCnt
End Sub

Any help would be greatly appreciate, any code snippets, anything to fix this, I would be soooo happy. thanks in advance!

Viewing all articles
Browse latest Browse all 21990

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>