libs/neuronet: Implemented UDP protocol support.
commit637ec40bdf738c79f6e45d5149c37b0b58a6736b
authorNicholas Niro <nik_89@xroutine.net>
Thu, 3 Jul 2014 03:23:11 +0000 (2 23:23 -0400)
committerNicholas Niro <nik_89@xroutine.net>
Thu, 3 Jul 2014 03:23:11 +0000 (2 23:23 -0400)
tree866b935d7855898278efcdbd7684822905a75c7a
parentc93393c11f147ad609821de65a25530fa1c171b2
libs/neuronet: Implemented UDP protocol support.

It is now possible to change which protocol the connections (client and
server) uses. We used to support only TCP connections but this change
also adds UDP. The new public interface function NNet_SetProtocolType
is to be used to set which protocol to use.

UDP is a connectionless protocol and as such, it also does not support
full duplex for server sockets. Suprisingly, UDP needs an open port
on the server and the client to function correctly. It does not appear
so for the programmer because this was made transparently. It does
not appear to administrators neither because the firewalls are made
to let pass unprivileged ports without any problem.

The best way I could implement UDP was to maintain a state for client
connections on a server instance. This state is searched for every
packets recieved to find the corresponding Slave struct and it then
does almost exactly the same steps as for TCP.
include/neuro/nnet/libnnet.sym
include/neuro/nnet/network.h
libs/neuronet/client.c
libs/neuronet/common.h
libs/neuronet/interface.c
libs/neuronet/master.c
libs/neuronet/server.c