How read and write is performed using sockets?
An application program interface gives the details of how can an application program interacts along with protocol software. But socket API is a defacto standard. One time a socket has been established an application that can transfer information.
recv( ) and send( ) are utilized to read and write the data.
recv(socket , buffer, length, flags)
The socket is the descriptor of the socket, buffer gives the address in memory where incoming message must be placed and length gives the size of the buffer, flags al low the caller to control details.
send(socket , data, length, f lags)
There is data of the address of data to be sent and other arguments are same.
Sockets also al lows read( ) and write( ) to transfer data as send ( ) and recv( ).read( ) and write() contain three arguments: a socket descriptor, the location of the buffer into the memory and the length of the memory buffer.