Tuesday, April 6, 2010

Lecture 17: Socket Programming Issues

Today's lecture started as all lectures do, with a review of the previous topic, 'TCP/UDP Sockets'. Dr. Gunes began by reiterating the specific code used to create a TCP socket. He also discussed other specific code and functions that are used to access data coming and going to and from the transport layer. Included functions were: listen(), accept(), and close(). These functions are system calls because they interface with hardware inaccessible at the application layer. After re-explaining the TCP calls, the professor progressed to TCP's sloppy brother, UDP. He mentioned several more system calls and some errors.

After the lecture review was complete, the professor transitioned to the new information. The main idea of this lecture was to take the system calls and low level interface from the previous lecture and understand how to use these tools to create functional applications using the protocols.

The first application the instructor discussed was a generic TCP client. When designing such an application many things have to be taken into account. If blocking IO is used, the listening aspect of the program must be in a separate thread. If the IO is non-blocking, then it must be polled continuously.

Another option is to use alarms and interrupts. Or, the "select()" function could be used. The instructor then spent several slides describing how to use the select function.

After discussing these programming decisions, specific errors were discussed. We learned about error codes and how to read their descriptions using the strerror() function.

Following the errors, general programming strategies for both clients and servers were discussed. When designing a client several things must be attended to, these include: identifying the server and port selection. When designing a server, the programmer must decide between concurrent client handling and iterative. Between these two choices are many differences that must be considered.

No comments:

Post a Comment