wiki:Internal/PacketServer

Packet server

Packet source

A TCP based packet source is available on idb2:5123 generates random packets prepended with a CRC and Seq#. Clients can request packets from server with the following handshaking process after a TCP socket connection has been established:

  1. client sends server the request packet size (byte 4 word)
  2. server sends client packet of requested size with the following fields (4 byte each):

| CRC - Seq# - pyld[0] - … - pyld[pkt-size-3] |

CRC is calculate from Seq#to pyld[pkt-size - 3]
Seq#is an incrementing count for the packet number
pyld[n] is the random data.

The above handshake process [t1,t2] will repeat for 120 seconds after which the connection will be terminated.

Packet sink

Similarly a TCP based packet sink available on idb2:5125 which receive packets from client. and verifies the CRC. As of right now this packet sink is best used for looping back data from the packet server. Clients can send data to server after a connection has been established:

  1. server sends client a ready packet (4 byte word)
  2. client sends server data with the following field (4 byte each):

| CRC - Seq#- pyld[0] - pyld[1] - … - pyld[pkt-size-3] |

CRC is calculate from Seq#to pyld[pkt-size - 3]
Seq#is an incrementing count for the packet number
pyld[n] is the random data.
Note: pkt-size is determined from a socket read function in server.

An example client

A python based client code has been attached for reference.

nilanjan@console.grid:~/CODE/pkt_client$ ./client.py
Requesting  1024  bytes
Seq #: 0  with CRC [ 0xbf4d4f4dL ]
Seq #: 1  with CRC [ 0x6b567e27 ]
Seq #: 2  with CRC [ 0x41a3778c ]
Seq #: 3  with CRC [ 0x35735fdd ]
Seq #: 4  with CRC [ 0x354d9012 ]
Seq #: 5  with CRC [ 0x3383b06a ]
Seq #: 6  with CRC [ 0xd4e9ed05L ]
Seq #: 7  with CRC [ 0x3ee8ee8d ]
Seq #: 8  with CRC [ 0x22d07f05 ]
Seq #: 9  with CRC [ 0x945f117fL ]
Seq #: 10  with CRC [ 0x50ca22f4 ]
Seq #: 11  with CRC [ 0x1b87b63f ]
Seq #: 12  with CRC [ 0xe8534403L ]
Seq #: 13  with CRC [ 0x9ff260caL ]
Last modified 11 years ago Last modified on Feb 12, 2013, 4:13:55 PM

Attachments (1)

  • client.py (630 bytes ) - added by nilanjan 11 years ago.

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.