All pastes #674489 Raw Edit

Unnamed

public text v1 · immutable
#674489 ·published 2007-08-29 09:18 UTC
rendered paste body
Private Sub sckServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    ' Allows more than one user to connect.
    idxConnection = idxConnection + 1           ' Increment Index
    Load sckServer(idxConnection)               ' Load new Socket with our new Index
    
    sckServer(idxConnection).Accept requestID   ' Accept connection
    
    sckServer(idxConnection).SendData "LOGON" & ".:." & strSysopNickname
End Sub

Private Sub sckServer_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    Dim strInText As String, intSocket As Integer
    
    sckServer(Index).GetData strInText                          ' What is coming in?
    
    For intSocket = 0 To idxConnection Step 1                   ' How many clients connected?
    If sckServer(intSocket).State = sckConnected Then           ' If we are connected?
        sckServer(intSocket).SendData strInText                 ' Resend the data
        DoEvents
    End If
    
    strParsed() = Split(strInText, ".:.")                       ' Split incoming string
    
    Select Case strParsed(0)
        Case "LOGON"
            lstOnlineUsers.AddItem strParsed(1)                 ' Add Nickname to listbox
        Case "PRIVMSG"
            frmPrivmsg.Show
            frmPrivmsg.txtPrivmsg.Text = _
            frmPrivmsg.txtPrivmsg.Text & strParsed(1) & ": " & strParsed(2) & vbCrLf
        Case Else                                               ' do a carriage return and line feed.
            MsgBox "Unknown Header", vbCritical, "Header Unknown"
    End Select
    Next intSocket
End Sub