1 / 8

High Level Socket API

High Level Socket API. Dr. Sanjay P. Ahuja, Ph.D. 2010-14 FIS Distinguished Professor of Computer Science School of Computing, UNF. The Client-Server Model. An application that initiates communication is a client .

bakergeorge
Download Presentation

High Level Socket API

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. High Level Socket API Dr. Sanjay P. Ahuja, Ph.D. 2010-14 FIS Distinguished Professor of Computer Science School of Computing, UNF

  2. The Client-Server Model • An application that initiates communication is a client. • A server is any program that waits for incoming communication requests from a client. • Standard client programs included with TCP/IP software include telnet client, SSH client, email client, ftp client etc. The client-server model involves requests and replies.

  3. Types of Servers: Connectionless vs. Connection-Oriented servers • If client and server communicate using User Datagram Protocol (UDP), the interaction is connectionless. If they use Transmission Control Protocol (TCP), the interaction is connection-oriented. • TCP provides the reliability needed to communicate across the Internet. • It retransmits segments that do not arrive correctly at the destination • It uses checksum to ensure data received is not corrupted during transmission • It uses sequence numbers to ensure data arrives in orderetc. • UDP provides “best-effort” service and does not guarantee reliable delivery. • It is suited to real-time, audio/video streaming traffic.

  4. Types of Servers: Iterative vs. Concurrent servers • An iterative server will service one client request before moving onto the next request. In this scenario, queues can build up. • A concurrent server will spawn a new (child) process (or thread) to service a client request and itself listen for the next client connection. This generally provides quicker response time. • Server software must be explicitly programmed to handle concurrent client requests because multiple clients contact a server using its single, well-known protocol port. • The fork() function call is used to create a new process in UNIX/Linux. This call causes the O/S to make a copy of the executing program and allows both copies to run at the same time. The call returns a finite value (process ID# of child process) to the calling (parent) process and a value of 0 to the child process.

  5. Types of Servers: Iterative vs. Concurrent servers

  6. The Socket API • TCP/IP software reside in the O/S. So application programs need to interact with the O/S to use TCP/IP to communicate. The routines provided by the O/S defines the API. • The Socket Interface from UC Berkeley is such an interface for the BSD UNIX O/S for application programs to interact with the TCP/IP software residing in the O/S. • A socket is one end-point of a two-way communication link between two programs running on the network. • TCP/IP protocols define a communication endpoint to consist of an IP address and a protocol port number.

  7. Outline for typical concurrent servers int pid,s, conn; S = Socket( .. ); // fill in server address Bind(s, ..); Listen(s, LISTNQ); while(1){ conn = Accept(s, ..); //blocking call if( (pid = fork()) ==0) { close (s); //child closes listening socket doit( conn); //service request close(conn); exit(0); //child exits } // end of if close(conn); //parent closes connected socket }// end of while loop

More Related