The SCTP protocol has a user space implementation that can run over UDP. This will give you most of the same guarantees as TCP, as well as some additional features such as multi-homing, keepalives, a message-oriented stream, and support for multiple streams within a single connection: https://code.google.com/p/sctp-refimpl/ https://code.google.com/p/sctp-refimpl/source/browse/#svn%2Ftrunk%2FKERN%2Fusrsctp It would be really neat to see nanomsg support this as a transport, IMO. > -----Original Message----- > From: nanomsg-bounce@xxxxxxxxxxxxx [mailto:nanomsg-bounce@xxxxxxxxxxxxx] > On Behalf Of Matthew Hall > Sent: Wednesday, March 25, 2015 7:38 PM > To: nanomsg@xxxxxxxxxxxxx > Subject: [nanomsg] Re: NAT transport > > On Wed, Mar 25, 2015 at 07:32:46PM -0400, George Walker wrote: > > Instead of reimplementing those desirable attributes of TCP for UDP, > might > > it be less work to take a TCP stack that already runs in userspace and > hack > > it to run TCP over UDP? > > It's an option. But the code of full featured TCP stacks is so massive > it's > hard to fathom, and often tied to a lot of implementation details of the > memory management subsystems of whatever it's taken from. > > How do I know this? I looked at stealing code from Linux, BSD, LWIP, > Minix, > and several other TCP stacks for the open source project in which I am > using > nanomsg, for a different area in the code from where nanomsg is used. > > The code of the full featured stacks ended up being so complex, weird, > and > undocumented, that it was easier for me to write the stack myself from > scratch > using textbooks and the TCP RFCs. > > Matthew.