SOCKET
The SOCKET Connector can be used for sending data to a device via a TCP/IP Socket Connection.
SOCKET Map Configuration
config.xml
<map id="map430" enabled="Y" description="GEN XML to SOCKET"> <input id="in1" description="Read XML Document"> <type>XML</type> <path>./interface/input/430 (GEN XML to SOCKET)</path> <mask/> <pollingInterval>1000</pollingInterval> <XSLT/> </input> <output id="out1" enabled="Y" description="Send to Host"> <path>./interface/output/430 (GEN XML to SOCKET)</path> <type>SOCKET</type> <host> <ip>127.0.0.1</ip> <socket>8000</socket> </host> <copies>2</copies> <XSLT/> </output> </map>
Sample XML
Socket Data.xml
<?xml version="1.0" encoding="UTF-8"?> <line eol="cr">^XA</line> <line eol="cr">^FX Top section with company logo, name and address.</line> <line eol="cr">^CF0,60</line> <line eol="cr">^FO50,50^GB100,100,100^FS</line> <line eol="cr">^FO75,75^FR^GB100,100,100^FS</line> <line eol="cr">^FO88,88^GB50,50,50^FS</line> <line eol="cr">^FO220,50^FDInternational Shipping, Inc.^FS</line> <line eol="cr">^CF0,40</line> <line eol="cr">^FO220,100^FD1000 Shipping Lane^FS</line> <line eol="cr">^FO220,135^FDShelbyville TN 38102^FS</line> <line eol="cr">^FO220,170^FDUnited States (USA)^FS</line> <line eol="cr">^FO50,250^GB700,1,3^FS</line> <line eol="cr">^FX Second section with recipient address and permit information.</line> <line eol="cr">^CFA,30</line> <line eol="cr">^FO50,300^FDJohn Doe^FS</line> <line eol="cr">^FO50,340^FD100 Main Street^FS</line> <line eol="cr">^FO50,380^FDSpringfield TN 39021^FS</line> <line eol="cr">^FO50,420^FDUnited States (USA)^FS</line> <line eol="cr">^CFA,15</line> <line eol="cr">^FO600,300^GB150,150,3^FS</line> <line eol="cr">^FO638,340^FDPermit^FS</line> <line eol="cr">^FO638,390^FD123456^FS</line> <line eol="cr">^FO50,500^GB700,1,3^FS</line> <line eol="cr">^FX Third section with barcode.</line> <line eol="cr">^BY5,2,270</line> <line eol="cr">^FO100,550^BC^FD12345678^FS</line> <line eol="cr">^FX Fourth section (the two boxes on the bottom).</line> <line eol="cr">^FO50,900^GB700,250,3^FS</line> <line eol="cr">^FO400,900^GB1,250,3^FS</line> <line eol="cr">^CF0,40</line> <line eol="cr">^FO100,960^FDShipping Ctr. X34B-1^FS</line> <line eol="cr">^FO100,1010^FDREF1 F00B47^FS</line> <line eol="cr">^FO100,1060^FDREF2 BL4H8^FS</line> <line eol="cr">^CF0,190</line> <line eol="cr">^FO485,965^FDCA^FS</line> <line eol="cr">^XZ</line> <line>*EOF*</line> 1234 data
In this example the map assumes that the input document is in the correct format to be used by the connector. However you can read the data from a plain ASCII file or CSV and then apply a XSLT transformation to format the data into the format shown above.
The actual commands being transmitted here are ZPL (Zebra Printer Language) used to print a barcode label.
Such an example would look something like this.
CSV to SOCKET Map Configuration
config.xml
<map id="map430" enabled="Y" description="GEN XML to SOCKET"> <input id="in1" description="Read XML Document"> <type>XML</type> <path>./interface/input/430 (GEN XML to SOCKET)</path> <mask/> <pollingInterval>1000</pollingInterval> <XSLT>CSV_to_SOCKET.xsl</XSLT> </input> <output id="out1" enabled="Y" description="Send to Host"> <path>./interface/output/430 (GEN XML to SOCKET)</path> <type>SOCKET</type> <host> <ip>127.0.0.1</ip> <socket>8000</socket> </host> <copies>2</copies> <XSLT/> </output> </map>
The above illustration adds the following element `<XSLT>CSV_to_SOCKET.xsl</XSLT>` and it would need to transform the XML internal representation of the CSV data into the SOCKET message format.
For an exmaple of how CSV data is loaded into an intermediate XML document refer to the CSV Connector documentation