Continued work on libclsync.

Common code was been moved from control.c to socket.c