Sub Class_Globals
Private cserver As ServerSocket
Private astreams As AsyncStreams
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
cserver.Initialize(3556,"cserver")
cserver.Listen
Log("Server Socket running >: "&cserver.GetMyIP&":3556")
End Sub
private Sub cserver_NewConnection (Successful As Boolean, NewSocket As Socket)
If (Successful = True) Then
Log("Um usuario foi conectado")
astreams.Initialize(NewSocket.InputStream,NewSocket.OutputStream, "astreams")
Else
Log("Erro ao conectar.")
End If
End Sub
Sub astreams_Terminated
Log("Baitola Desconectado.")
End Sub
Sub astreams_NewData (Buffer() As Byte)
Dim msg As String
msg = BytesToString(Buffer, 0, Buffer.Length, "UTF-8")
Log("Msg recebida = "&msg)
End Sub