Sub InviaComandoCustom (comando As String )
If clientSocket.Connected = True Then
Log("Inizio Invio comando")
'AStreams1.InitializePrefix(clientSocket.InputStream,False,clientSocket.OutputStream,"clientSocket")
Dim stringa As String = NumberFormat(Main.contatore,2,0) & "0" & comando
Dim ck As Int = CalcolaCK(stringa)
stringa = stringa & NumberFormat(ck,2,0)
If Main.contatore = 99 Then
Main.contatore = 0
End If
Dim b(stringa.Length + 2) As Byte
b(0) = 2
b(stringa.Length + 1) = 3
Dim BC As ByteConverter
Log("send : " & stringa)
BC.ArrayCopy(stringa.GetBytes("ASCII"),0,b,1,stringa.Length)
If clientSocket.IsInitialized = True And clientSocket.Connected = True Then
AStreams1.Write2(b,0,b.Length)
End If
Main.contatore=Main.contatore+1
Log("FINE INVIO COMANDO")
Else
Msgbox2Async("Nessuna Stampante connessa , riprovare il collegamento ? ","ERRORE","SI","NO","",Null,False)
Wait For Msgbox_Result (Result As String)
If Result = DialogResponse.POSITIVE Then
AvviaConnessione
End If
End If
End Sub