The call to the function ‘listen()’ with second argument as ’10’ specifies maximum number of client connections that server will queue for this listening socket.The details include, the family/domain, the interface to listen on(in case the system has multiple interfaces to network) and the port on which the server will wait for the client requests to come. The call to the function ‘bind()’ assigns the details specified in the structure ‘serv_addr’ to the socket created in the step above.For connection oriented reliable connections, the default protocol used is TCP. The third argument is generally left zero to let the kernel decide the default protocol to use for this connection.The second argument ‘SOCK_STREAM’ specifies that the transport layer protocol that we want should be reliable ie it should have acknowledgement techniques.For Internet family of IPv4 addresses we use AF_INET. This function takes domain/family as its first argument.The call to the function ‘socket()’ creates an UN-named socket inside the kernel and returns an integer known as socket descriptor.In the above program, we have created a server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |