SocketTest
SocketTest is a TCP/IP network testing utility with a graphical interface. It acts as both a TCP client and a TCP server, allowing you to send and receive arbitrary data over a socket connection, debug protocol implementations, and simulate network endpoints. It is a companion tool to LabelServer4j, AutoLab4j, and ZPL Renderer, which all communicate with devices over raw TCP/IP sockets.
Purpose
SocketTest is useful when:
- Testing whether a printer or other device is accepting connections on a given IP address and port
- Checking what a device responds with when given a specific command
- Sending raw ZPL or Logopak commands to a printer to verify a script without running the full service
- Acting as a test server to capture what LabelServer4j or AutoLab4j is actually transmitting
Running SocketTest
Native install packages for Windows, macOS, and Linux are available from the Downloads page and are the preferred installation method.
Alternatively, SocketTest can be run directly from the distribution archive. It is a Java 21 desktop (Swing) application:
java -jar SocketTest.jar
The main window contains two tabs: Client and Server. Both tabs can be used independently or together in proxy mode.
Client Tab
The client tab connects to a remote TCP server.
Connecting
Enter the IP address and port of the remote server and click Connect. The IP address dropdown is pre-populated with the network interfaces found on the local machine. The default port is 9100 (the standard raw Zebra print port).
Sending Data
Type or load the message you want to send in the left-hand text area. Use the prefix and suffix dropdowns to select control character sequences that will be prepended or appended to the message:
| Token | Character |
|---|---|
| (none) | No delimiter |
<CR> |
Carriage return (0x0D) |
<LF> |
Line feed (0x0A) |
<CR><LF> |
Carriage return + line feed |
<STX> |
Start of text (0x02) |
<ETX> |
End of text (0x03) |
<ESC> |
Escape (0x1B) |
<ACK> |
Acknowledge (0x06) |
<NAK> |
Negative acknowledge (0x15) |
Click Send to transmit. The right-hand log pane shows all data sent and received, colour-coded in green on a black background.
Loading and Saving Messages
Use Load to populate the input area from a text file, and Save to persist the input area contents. Use Clear and Save on the log pane to manage the communication history.
Server Tab
The server tab listens for incoming TCP connections.
Starting the Server
Enter the bind IP address (or 0.0.0.0 to listen on all interfaces) and the port, then click Open. When a client connects, its hostname and IP address are shown in the panel border. The Disconnect button closes the current client connection without stopping the server.
Sending Responses
Once a client is connected you can type a response in the input area and click Send to transmit it back to the client. All data received from the client is shown in the log pane, colour-coded in white on a black background.
Proxy Mode
The Proxy button on the server tab enables transparent data relay. When proxy mode is active, data received on the server side is automatically forwarded to whatever the client tab is connected to, and vice versa. This allows SocketTest to sit between a client and a real device and relay all traffic in both directions, which is useful for capturing a complete protocol conversation.
Control Characters
Control characters are entered in human-readable token notation (<STX>, <CR>, etc.) in the input area and converted to the actual byte values before transmission. Incoming bytes are decoded back to token notation in the log. SocketTest supports the full standard ASCII control character set (NUL through DEL).
Configuration
SocketTest has no persistent configuration file. IP addresses, ports, and message formatting options are per-session only and reset when the application is closed.
Log Files
SocketTest does not write a log file. All communication history is displayed in the on-screen log panes and can optionally be saved to a text file using the Save button on each pane.
See also: LabelServer4j, ZPLRenderer, Production Lines & Labellers