port to FreeBSD 10 & OSX 10.9.5

I have verified that this works on FreeBSD 10.  I left it running overnight with no issues.

On OS X I can build it, but it is failing with errno 65 'no route to host'? even though it actually works.
I can route around the issue by setting errno=0 just before the reconnect checks in the two clients.
I've done some instrumentation to try to discover which syscall is setting errno, but I've run out of time to work on this today.

You should be able to just run ```
make CXX=g++
``` without this line.