Bidirectional communications using Python

Article ID: 13102764

Issue / Question

Bidirectional communications programming example using Python

Issue Details

Python, bidirectional, ZPL, network, socket, programming

Applicable To

Developers seeking a programming example showing bidirectional communications

Resolution / Answer

 

import socket              
mysocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)         
host = "10.80.209.106" 
port = 9100   
try:           
	mysocket.connect((host, port)) #connecting to host
	mysocket.send(b"~hs")#using bytes
	data = mysocket.recv(1024)
	stringdata = data.decode('utf-8')
	print(stringdata) 
	mysocket.close () #closing connection
except:
	print("Error in connection")


 

+ Applicable Products

  • 105SLPlus Industrial Printers
  • 105SLPlus Industrial Printers
  • 110PAX Print Engines (disc.)
  • 110Xi4 Industrial Printer
  • 140Xi4
  • 140Xi4 Industrial Printer
  • 170PAX4
  • 170Xi4 Industrial Printer
  • 220Xi4 Industrial Printer
  • 2824 Plus Series
  • 2824-Z Series
  • G-Series GK Desktop Printers
  • G-Series GX Desktop Printers
  • G-Series GX Desktop Printers
  • GK420 Healthcare Desktop Printers
  • GK420d Desktop Printer
  • GK420d Healthcare Desktop Printer
  • GK420e
  • GK420t Desktop Printer
  • GK420t Healthcare Desktop Printer
  • GK888 Desktop Printer
  • GK888d
  • GK888t
  • GX420Rx Desktop Printer
  • GX420d Desktop Printer
  • GX420t Desktop Printer
  • GX420t Product Printers
  • GX430d Desktop Printer
  • GX430t Desktop Printer
  • HC100 Wristband Printer
  • HC100 Wristband Printer
  • Kiosk Printers
  • LP 2824 Plus Desktop Printer
  • Portfolio & Product
  • Printers
  • QLn Series Healthcare Mobile Printers
  • QLn Series Mobile Printers
  • QLn220 Mobile Printer
  • QLn320 Healthcare
  • QLn320 Mobile Printer
  • QLn420 Mobile Printer
  • S4M
  • S4M Series
  • Solutions and Verticals
  • TLP 2824Plus Desktop Printer
  • Xi Series Industrial Printers
  • Z Series Industrial Printers
  • ZD410 Series
  • ZD410-HC
  • ZD410D
  • ZD420 Series
  • ZD420-D-T
  • ZD420-D-T-HC
  • ZD420-HC
  • ZD420C
  • ZD420D
  • ZD420D-HC
  • ZD420T
  • ZD420T-HC
  • ZD500 Desktop Printer
  • ZD500 Desktop Printer
  • ZD620 Series
  • ZD620-D-T
  • ZD620-D-T-HC
  • ZD620D
  • ZD620D-HC
  • ZD620T
  • ZD620T-HC
  • ZE500 Print Engines
  • ZE500 Print Engines
  • ZM400
  • ZM600
  • ZQ500 Series Mobile Printers
  • ZQ510 Mobile Printer
  • ZQ520 Mobile Printer
  • ZT200 Series Industrial Printers
  • ZT210 Industrial Printer
  • ZT220 Industrial Printer
  • ZT230 Industrial Printer
  • ZT400 Series Industrial Printers
  • ZT410 Industrial Printer
  • ZT420 Industrial Printer
  • ZT500 Industrial Printers
  • ZT510 Industrial Printer
  • ZT600 Series Industrial Printers
  • ZT610 Industrial Printer
  • ZT620 Industrial Printer
  • iMZ Series Mobile Printers
  • iMZ220 Mobile Printer
  • iMZ320 Mobile Printer