Provide a new system call to enable reconfiguration of a socket.
Original Publication Date: 2004-Aug-02
Included in the Prior Art Database: 2004-Aug-02
On a busy server servicing client requests and in several networking applications, need arises to close an existing socket and create a new one and bind it to a port. This process can take several system calls like close() to close an existing socket, socket() to create a new socket and bind() to bind the new socket to a port. These in turn involve freeing of socket memory and reallocating it. The server performance can greatly improve if the overhead of above system calls can be reduced.
Provide a new system call to enable reconfiguration of a socket .
To solve the above problem a new system call is needed. The new system call socket_reconfig() will replace the above three system calls and prepare a socket to be able to accept() connections for connection oriented communication or accept data for connection-less communication.
Advantage of using this invention is improved server performance, achieved because :
a). Freeing the socket memory is not required since the close() system call is eliminated.
b). No separate socket memory allocation required as we re-use the socket memory.
c). Less number of instruction cycles as one system call now replaces three system calls.
d). Application programs can be simplified. Many client applications need to close a socket for one server and open a new socket to contact a different server. Eg. Resolver when it receives an error from a name server. Following is the definition of the socket_reconfig() system call
int socket_reconfig(int sd, int family, int type, struct sockaddr *mysockaddr, int size);
The first argument, sd, is the existing socket to be reconfigured. The second and third arguments are the family and type of the new socket respectively. The fourth argument is a pointer to the sockaddr structure which contains the new IP address and port information to bind to the socket. The final argument is the size of the sockaddr structure.
It returns zero for successful completion or a non-zero error value.