User's Guide

Tarvos User Guide - Version 0.3 14
3.2 Event Channel (port 50008)
The reader port 50008 is a raw TCP port. It is a one-way channel in that it does not process data coming
into the Tarvos reader. It only sends asynchronous event data out. Each asynchronous event is terminated
with “\r\n\r\n”.
Upon first connecting to port 50008, the Tarvos reader will output an event connection string followed by
the identification of the reader channel (e.g.event.connection id=536961760). This ID field will be used in
determining which events the channel is subscribed to (please see the TSI documentation on the
“reader.events.register()” function.
Please note that the “event.connection id” value will remain constant while the event channel is
connected. However, this value is not guaranteed to be the same on subsequent connections to the event
channel. Each time a connection to the event channel is established the value of the “event.connection id”
may be different.
Here is an example of event channel processing in Python:
import socket
host_ip = "169.254.0.20"
event_channel_port = 50008
event_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
event_socket.connect((host_ip, event_channel_port))
response = event_socket.recv(256)
i1 = response.find('event.connection id =') + len('event.connection id =')
i2 = response.find('\r\n\r\n')
id = int(response[i1:i2])
print "Channel ID: ", id
while 1:
response = event_socket.recv(256)
print response