Create a connection of an arbitrary type

Provide a generic way to create a connection of an arbitrary type and from a particular domain

Division of two peers on server and client is purely abstract, because actually just after creating a connection of type SOCK_STREAM we close real server socket and associate its child socket, with srvr_s parameter of the function.

For connection of type SOCK_STREAM use algorithm Create a connection with connection oriented sockets.

For connection of type SOCK_DGRAM use algorithm Create a connectionless pair of sockets that can communicate with each other without specifying any addresses in their I/O operations.

Parameters:

srvr

PCO where server socket is created

clnt

PCO where client socket is created

sock_type

Socket type used in the connection

proto

Protocol for the connection

srvr_addr

Server address to be used as a template for bind() on server side

clnt_addr

Address to bind client to

srvr_s

Descriptor of the socket reside on srvr (accepted socket in the case of stream connection) (OUT)

clnt_s

Descriptor of the socket reside on clnt (OUT)