what functions connect and accept call in


What functions connect( ) and accept ( ) call in Socket interfacing?

connect() system call:

Clients use procedures connect to initiate connection with an exact server. The form is connect ( socket , saddress, saaddresslen)

Argument socket is the descriptor of a socket upon the client's computer to utilize for the connection. Argument sockaddress is a sockaddr structure which specifies protocol port number and the server's address. Argument saaddresslen identifies the length of the server's address measured in octets.

The client doesn't have to bind a local address before call ing connect( ).

connect( ) inside can call bind() to connect to a local address if not completed previous.

accept() system call:

After a connection oriented server executes the listen( ) system call , a real connect ion from some client process is waited for throgh having the server execute the accept () system call. Therefore the form is:

accept (sockfd, sockaddr * peer, int* addrlen)

Such system call returns up to three values: an integer return code which is either an error indication or a newly socket descriptor, the address of the client process (i.e. peer) and the size of such address(i.e. addrlen).

Accept automatically creates a new socket descriptor, supposing the server is a concurrent server.

While a connection request is obtained, the process forks, along with the child process servicing the connection and also the parent process waits for the other connection request.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: what functions connect and accept call in
Reference No:- TGS0283726

Expected delivery within 24 Hours