Author Topic: Zebra Printer with AHMI  (Read 2769 times)

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Zebra Printer with AHMI
« 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 
« Last Edit: May 30, 2016, 08:01:26 AM by aquilmustafa »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Zebra Printer with AHMI
« Reply #1 on: May 30, 2016, 09:16:08 AM »
It's not necessary to close 44818. You can have multiple Ethernet ports open at the same time.

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Zebra Printer with AHMI
« Reply #2 on: May 30, 2016, 09:42:49 AM »
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

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Zebra Printer with AHMI
« Reply #3 on: May 30, 2016, 09:45:36 AM »
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

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Zebra Printer with AHMI
« Reply #4 on: May 30, 2016, 09:52:33 AM »
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.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Zebra Printer with AHMI
« Reply #5 on: May 30, 2016, 10:21:01 AM »
See if this works:
Code: [Select]
        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

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Zebra Printer with AHMI
« Reply #6 on: May 30, 2016, 10:27:35 AM »
 :) Thanks a Lot Archie,

It's working..

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Zebra Printer with AHMI
« Reply #7 on: September 29, 2018, 10:17:46 PM »
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
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Zebra Printer with AHMI
« Reply #8 on: September 30, 2018, 05:44:12 AM »
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