473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

sending string thru TCP/IP

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...
Nov 21 '05 #1
3 6381
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" <no*********@discussions.microsoft.com> wrote in message
news:87**********************************@microsof t.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...

Nov 21 '05 #2
Hi,

can u elaborate more? example?

"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" <no*********@discussions.microsoft.com> wrote in message
news:87**********************************@microsof t.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...


Nov 21 '05 #3
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
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: vardhansasi | last post by:
I m a newbie to PHP and Mailing.I recently installed qmail on my system.and hope its working fine. i need help in sending/ receiving/handling mails thru PHP. thanx for tring to help.
11
by: ckerns | last post by:
I have a form with 40 text boxes (default of each = 0). I want to evaluate each box to see if the value is still zero, and if it is, I want to add it to a "Zero Count". The box names are "L411...
5
by: Ken Nistler | last post by:
Hello, I was wondering if anyone can help me out. I am trying to send mail from a c# app thru my ISP pop3 mail server. I figured it would be similar to using SMTP, but use my username and...
7
by: Lau | last post by:
I need to send 1000 emails from an asp.net website. Normally I would use System.Web.Mail.MailMessage() to send thru an SMTP server. But the large amount of emails results in a timeout. My server...
0
by: salman | last post by:
Hello i have to broadcast over vpn. I have local network and vpn, LAN ips are 192.168.1.x and vpn ips are 10.0.0.x. i am creating vpn thru windows server 2003 RAS. i have to broadcast msgs over...
4
by: BA | last post by:
Hello, I have a very strange code behavior that I cannot make heads or tails of: I have c# code being executed in BizTalk assemblies which is acting very strangely. In my BizTalk process I...
5
by: =?Utf-8?B?RG9taW5v?= | last post by:
Greetings all, I'm trying to send an e-mail from a Windows application thru MS Exchange Server 2007 that is in my LAN. The setup for Exchange server is very basic, it's running on Server 2003...
1
by: Sangamesh | last post by:
Hello I hava a problem while sending a text message to mobile thru internet the characters which are after a # symbol are not sent to the respective number. I want to know the reason behind this and...
0
by: vigneshrao | last post by:
Hi, I have been working on a script that loops through multiple records and sends data (one record per call) to a WS. I am supposed to make a new call for each record before sending the data....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.