|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
sending string thru TCP/IPHi would i like to send string of PCL codes to a Printer which i have the IP
address, how do i send it? i'm currently using TCPclient class, but it could not work, as the printer would just hang... pls help me... you probably have to send it as bytecode data.
I am not sure about PCL. But I had to do that for my Datamax Thermal Printers. Convert the string to a correctly formatted bytecode array and then send that to your printer. Usually there are control characters involved for telling the printer to start printing and stop printing... -- Show quoteHide quote--Eric Cathell, MCSA "notregister" <notregis***@discussions.microsoft.com> wrote in message news:87B80034-C10F-4BA6-B433-6CDDC33407C1@microsoft.com... > Hi would i like to send string of PCL codes to a Printer which i have the > IP > address, how do i send it? > > i'm currently using TCPclient class, but it could not work, as the printer > would just hang... > > pls help me... Hi,
can u elaborate more? example? Show quoteHide quote "ECathell" wrote: > you probably have to send it as bytecode data. > > I am not sure about PCL. But I had to do that for my Datamax Thermal > Printers. Convert the string to a correctly formatted bytecode array and > then send that to your printer. Usually there are control characters > involved for telling the printer to start printing and stop printing... > > > -- > --Eric Cathell, MCSA > "notregister" <notregis***@discussions.microsoft.com> wrote in message > news:87B80034-C10F-4BA6-B433-6CDDC33407C1@microsoft.com... > > Hi would i like to send string of PCL codes to a Printer which i have the > > IP > > address, how do i send it? > > > > i'm currently using TCPclient class, but it could not work, as the printer > > would just hang... > > > > pls help me... > > > Private Function PrintThisPallet(ByVal label() As Byte, ByVal netstream As
NetworkStream) As Boolean Try Dim startPrint(3) As Byte startPrint = getStartPrint() Dim endPrint(2) As Byte endPrint = getEndPrint() If netstream.CanRead And netstream.CanWrite Then netstream.Write(startPrint, 0, startPrint.Length) netstream.Write(label, 0, label.Length) netstream.Write(endPrint, 0, endPrint.Length) Return True ElseIf Not netstream.CanRead Or Not netstream.CanWrite Then Return False End If Public Class TCPDatagram Private appsettings As New System.Configuration.AppSettingsReader() Private debugLevel As Integer = appsettings.GetValue("debuglevel", GetType(System.Int16)) Private mTcp() As TcpClient Private mNetStream() As NetworkStream Private mPortNumber As Integer = appsettings.GetValue("PortNumber", GetType(System.Int32)) Public Property TcpData(ByVal i As Integer) As TcpClient Get Return mTcp(i) End Get Set(ByVal Value As TcpClient) mTcp(i) = Value End Set End Property Public Property NetStream(ByVal i As Integer) As NetworkStream Get Return mNetStream(i) End Get Set(ByVal Value As NetworkStream) mNetStream(i) = Value End Set End Property Public Sub OpenDatagram(ByVal ip As String, ByVal index As Integer) Try '============================ 'ip = "192.168.155.99" '============================ Dim addy As System.Net.IPAddress = System.Net.IPAddress.Parse(ip) TcpData(index) = New TcpClient() TcpData(index).Connect(addy, mPortNumber) TcpData(index).SendTimeout = 2 TcpData(index).ReceiveTimeout = 5 NetStream(index) = TcpData(index).GetStream Catch ex As Exception If debugLevel = 1 Then MessageBox.Show(ex.Message, "OpenDatagram") End Try End Sub Public Sub CloseDatagram(ByVal index As Integer) Try NetStream(index).Close() TcpData(index).Close() Catch ex As Exception If debugLevel = 1 Then MessageBox.Show(ex.Message, "CloseDatagram") End Try End Sub Public Sub New(ByVal index As Integer) ReDim mTcp(index) ReDim mNetStream(index) Dim counter As Integer 'For counter = 0 To index ' mTcp(counter) = New TcpClient() 'Next End Sub End Class 'TCPDatagram
New To Imaging
How to create a Serialnumber for App programmatically? How to get form design view back? DateTimePicker Bug? Using MSCOMM32.ocx with VB.net Visual Basic App Memory Issue Can I pass value from VB form to VBS? SharpZipLib & Blocked File listboxes to select/deselect multiple items SharpZipLib |
|||||||||||||||||||||||