Dim AscoltoServer As ServerSocket
Dim ListaConnessiAstream As List
Dim ListaConnessiInfo As List
Dim TimElabora As Timer
Dim Cht As String = Chr(8)
End Sub
Sub Service_Create
If AscoltoServer.IsInitialized=False Then
AscoltoServer.Initialize(porta,"AscoltoServer")
ListaConnessiAstream.Initialize
ListaConnessiInfo.Initialize
End If
End Sub
Sub Service_Start (StartingIntent As Intent)
AscoltoServer.Listen
TimElabora.Initialize("TimElabora",1000)
TimElabora.Enabled=True
End Sub
Sub AscoltoServer_NewConnection (Successful As Boolean, NewSocket As Socket)
If Successful Then
Dim Stream1 As AsyncStreams
Stream1.Initialize(NewSocket.InputStream,NewSocket.OutputStream,"AStreams")
'Stream1.Write("ID".GetBytes("UTF8"))
ListaConnessiAstream.Add(Stream1)
Dim Elem As TElementi
Elem.Nome=ListaConnessiAstream.Size
Elem.DatiRicevuti=""
Elem.Ping=0
ListaConnessiInfo.Add(Elem)
ToastMessageShow("Cameriere connesso n." & ListaConnessiAstream.Size, False)
CallSub(Main,"AggiornaConnessioni")
Else
Log("Errore connessione server")
End If
AscoltoServer.Listen
End Sub