WL#1835: New SOCK type for communication

Affects: Server-4.1   —   Status: Un-Assigned

Info: I (Tomas Ulin) did a quick implementation and test of this but dod not get
any performance difference.

To enable that we can use TCP/IP socket strictly or
Unix socket/TCP/IP socket based on best performance we need a new
transporter type SOCK.

The current type TCP always TCP/IP sockets independent of how the
configuration is set-up.

The new type will use the most optimal socket implementation for the

For local connections on Unix this means that SOCK will use Unix sockets.

A description of using Unix sockets is provided here:

Instead of using struct sockaddr_in one instead uses
struct sockaddr_un.

On the client side this means that the code changes slightly:
1) First declare server address=servaddr using struct sockaddr_un instead of
struct sockaddr_in
2) Use AF_LOCAL instead of AF_INET in call to socket(..)
3) Set
strcpy(servaddr.sun_path, path_string)

in sockaddr_un struct before calling connect as usual
path_string is the path to file used for the socket communication

On the server side it also changes slightly:
1) same as 1) for client side
2) same as 2) for client side
3) unlink(path_string)
This is necessary to avoid problems with remaining files.
4) call bind, listen and accept as usual with the struct sockaddr_un reference

The socket option TCP_NODELAY is most likely not available on Unix sockets so
setting this should not be done for Unix sockets.

The server changes affects startTCPServer() and acceptClient() in 
TCP_Transporter.cpp and client changes affects connectClient() and
there are also changes in setSocketOptions().

It should be very easy to simply have a flag with if-statements in those
routines or something like that.

With union on struct sockaddr_in and struct sockaddr_un it should be possible
to use same calls in a few places.

The name on the file is proposed to be:

if communication is set-up between node 12 and node 14 using port 10101