I wrote this utility to try and take advantage of bonded interfaces when sending large data streams between hosts in my computer lab.
The idea is to split the data stream so that it can be transmitted on multiple interfaces simultaneously and then reassembled at the other end.
This implementation relies on L3+4 transmit hashing by creating a number of connections on different ports.
A connection is established on a single, known port and then sockets for the streams are established by the server and the port numbers transmitted to the client to complete the connections.
/* receive */
ncp recv [port] > out
/* transmit */
ncp send [host] [port] < in
This is just a proof of concept/simple tool for me to use so there's a lot that hasn't been done properly including
- data verification
- some error checking
- any proper error handling
- configurable stream count / block size
Issues:
- selecting a block size greater than ~16K causes socket errors when attempting to transmit
From repository directory:
gcc -o ncp *c lib/cobs/cobs.c -lpthread
- Client and server 'negotiate' the connection
- Stream connections are created and assigned to stream threads
- Data read from stdin in chunks up to a selected block size
- Block is assigned a sequence number and queued for transmission by a client stream thread
- Block is transmitted and received by a server stream thread
- Block is queued for processing by server join (reassembly) thread
- Server join thread maintains a list of cached blocks and writes out blocks in-sequence when available