AdvancedHMI Software
General Category => Open Discussion => Topic started by: aquilmustafa on May 30, 2016, 06:21:14 AM
-
Hi,
I have AHMI running on a Machine communicating with Clx via Ethernet port. Tricky part is that i want to print the String to Zebra Barcode printer via Ethernet on 9100 port when i receive a command from PLC.
OR
Is there a way to close port no 44818 and open 9100 send Printer data and close 9100 and restart 44818 for communicating with PLC
How is that possible please help me
-
It's not necessary to close 44818. You can have multiple Ethernet ports open at the same time.
-
Hey Archie,
Thanks for the prompt reply. Could you please guide me as to how it could be done I've been trying this method
Dim client As New System.Net.Sockets.TcpClient
client.Connect(ip, port)
'Write ZPL String to Connection
Dim writer As New System.IO.StreamWriter(client.GetStream())
writer.Write(ZPLString)
writer.Flush()
'Close Connection
writer.Close()
client.Close()
Thanks for the reply
-
Until Archie provides some solution, take a look at this and see if that might help:
http://stackoverflow.com/questions/16063822/i-am-trying-to-print-via-ethernet-on-a-thermal-printer-in-vb-net
-
Hey Godra,
Thanks for the link.
This program when written in a different solution prints out perfectly. Only problem comes when trying to Print through AHMI.
-
See if this works:
Dim endPoint As System.Net.IPEndPoint
endPoint = New System.Net.IPEndPoint("192.168.0.100", 9100)
Using TCPSocket As New System.Net.Sockets.Socket(endPoint.AddressFamily, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp)
TCPSocket.Connect(endPoint)
TCPSocket.Send(System.Text.Encoding.ASCII.GetBytes("Text to send"))
End Using
-
:) Thanks a Lot Archie,
It's working..
-
I am just starting with a ZT410. I am looking for some vb samples to print ZPL code directly using USB connection.
Would you have some codes to share. Thanks
-
I made a new topic with some sample code to show how I once did this. It did required a fair amount of code to do, but the code I posted is mostly re-usable.
https://www.advancedhmi.com/forum/index.php?topic=2209.0