InertiaM
Well-known member
I'm trying to send data to a label printer. Everything is fine, until I try and send it more than about 3000 bytes - it's as though either the extra data is not sent, or it is rejected.
This is the first time I've used .NET for socket programming - I always used to do it in VB6.
This is the first time I've used .NET for socket programming - I always used to do it in VB6.
VB.NET:
Private Sub TestPrintTCP()
Dim tcpSender As TcpClient = New TcpClient()
tcpSender.Connect("172.17.20.82", 8980)
If tcpSender.Connected = False Then
MessageBox.Show("Not connected")
tcpSender.Close()
Exit Sub
End If
'MessageBox.Show("Connected!")
Dim sTest As String = "WS;C;XS;" 'all my printer characters goes in here
Dim SendBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(sTest)
Dim nStream As NetworkStream = tcpSender.GetStream()
If nStream.CanWrite = True Then
MessageBox.Show(SendBytes.Length.ToString)
nStream.Write(SendBytes, 0, SendBytes.Length)
nStream.Flush()
End If
tcpSender.Close()
End Sub