August 11, 2009 | Filed Under Networking, Tips | No Comments
I Love use Binary formats, instead of XML, and JSON. Here is my Generic Binary Format for data transmissions or serializations. Data is composed by three blocks. The first one 1byte that describe all information about the object, like “is a single Int object” or “is a list”, then tells you the second block length. The second block contains the size of the third block (The Data-Block) or the Number of Items in List.

June 29, 2009 | Filed Under Networking | No Comments
When you work with Unreliable communication channel (like UDP), you need to implement your own “Reliable Mechanism” to be sure that packet that you’ve send was received correctly. Here there’s my attempt.
Reliable Transmitter:
The schema below shows the operations that reliable transmitter has to do. “Red” are “error or unexpected operations”, Green are “expected operations”, Blue are TX Operations.
Transmitter send a packet and waits for the ACK packet (sended by receiver). If ACK doesn’t arrive before the Tx Timeout packet is resended. When ACK arrive Tx send the CACK (Confirm ACK) packet and waits for a timeout, if another ACK Arrive TX resend the CACK, this because receiver doesn’t have the confirm of transmitter. When TX timeout all is done, and the packet is sended correctly.
Reliable Receiver:
The schema below shows the operations that reliable receiver has to do. “Red” are “error or unexpected operations”, Green are “expected operations”, Blue are Rx Operations.
When RX receive a Packet sends an ACK, and waits for the CACK, if CACK doesn’t arrive before timeout RX resend the ACK. When CACK arrive all is done. We’ve received the packet and the transmitter knows that we’ve received it.