|
My Telematics Course at the University of Wales I was very excited to have the opportunity to do this assignment. For one, it accomplished something that seemed really impressive (impressive to me, at any rate), but was very easy to do. For two, I learned something completely brand-new and useful and cool in a very short amount of time. The assignment: The purpose of the assignment was to gain practice in programming Internet applications in C. The requirements were to write two programs, a client and a server, which used socket interfaces to TCP/IP networking. The server was meant to be a drinks server. In other words, it accessed a database which stored recipes of various drinks. The client could connect to the server and request information from the server's drinks list. Details of the drinks server: Each record in the database of drinks contained five fields as follows:
All data passed between the client and server was in the form of character streams. The messages sent from the client consisted of a single letter representing a request, followed immediately by a three digit number, representing a record number. The letters used were:
The code: Here is my source code for both the client and server programs I wrote for the assignment. Please note that much of the code used to establish sockets and network connections was taken from notes in class. This is what made my job so easy. The rest only took me a few hours to work out. Source code for the drinks server. Source code for the drinks client.
|