Technical notes on TCP/IP methods

Top  Previous  Next

Why two communications channels?

 

The network administrators out there may be wondering why I didn't use out-of-band transmission on the main socket: because not all client languages (and not even all TCP implementations) support it.

 

Wide-area networks

 

The more network is in between the client and server, however, the less rapid the system's response becomes (especially on a busy network). This is why I recommend keeping the client and server on the same computer. However, it is easy to find out the status of the operant chambers from a different computer; I imagine this will be the main practical use of this feature. The design didn't depend on this, though; if you're going to separate the client and server, you need a communication protocol, and TCP/IP happens to carry associated benefits.

 

TCP port numbers

 

Every type of program that communicates over the Internet (or similar TCP/IP networks) has a port number. For example, the Web uses the HTTP protocol, which runs on port 80. The Whisker defaults to using 3233 as its main port.  This use is registered with the Internet Assigned Numbers Authority (IANA), so should not clash with any other functions on a network.

 

Network speed and concatenation of packets

 

For those interested in such technical matters, the server disables the Nagle TCP algorithm to ensure that all packets are sent immediately (this is achieved by instructing its sockets to set the parameter TCP_NODELAY). Nevertheless, if the server sends two packets in very quick succession, the TCP algorithm amalgamates them. This does make sense from a network performance point of view.

 

A similar problem is encountered when a large(ish) packet is sent – it is possible that the TCP/IP stack splits a message into two packets. For these reasons, there must be enough information in the data itself to establish where one command ends and the next begins, so a terminator signal (CR / LF / semicolon) is used.

 

Rat_greyscale