Internet Socket Programming in C under UNIX


 

London South Bank University

 

 

 

 

 

 

 

 

 

 

By

Nabeel Almulla

Supervisor

Dr. Goran Bezanov

Abstract

Socket is an Application Programming Interface (API) including a set of different types of functions, data structures and constants provided by operating system for network application. Internet socket is the basic building block for computer communication, and representing an end point of communication between any two processes running in the same machine or in different machines.

This project outlines how to write Internet socket programs in C language using UNIX as an efficient platform. It is describing the construction of the socket program, and creating four basic codes of socket programs for both client and server, and with two types of socket TCP and UDP depending on their algorithms. These basic codes designed to reuse as a templates in creating an enhanced socket programs to meet other design requirements.

The project offers a new design for basic socket code, which is very efficient in learning socket programs, and in development as well.

The whole paper consist of three parts, two of them are preparation and groundwork to the main objective represented by third part, which is writing Internet socket programs.

The first part is programming in C language using Microsoft Visual C++ program, it contains documentations and exercises for the most of C functions used in socket program codes.

The other part is a tutorial for learning programming in C under UNIX platform, it contains documentation and practices for the most command needed in working on UNIX terminal.

The last part is the technical approach, contains documentation of socket functions and creating a new-designed codes for sixteen different socket programs for the client and server.

All of the programs written, then compiled and tested on UNIX terminal, and the testing procedures for four of them were documented as it is one of the important procedures in software programming.

Top

Introduction

I understand that the operating system is one of the important components in any networking project, this is the fact that made me quite interested to study and understand how the operating system offering networking services.

Many people and researchers worked in socket programming, and produced different types of resources, but as far as I know, none of them offered a basic standard socket code simple, understandable and easy for any reader who want to learn, or doing any other improvements. Therefore, I found that there was a need to work on this topic in order to achieved a user manual, which is giving the reader a good knowledge and background in writing a C programs on UNIX, and learning writing socket programs in the method that I suggested and designed it, after that writing many functional socket programs that can be used in the client server architecture.

Writing any socket program in C requires an understanding of C programming language and an understanding of the programming environment (i.e. compilers, header files, libraries and make files). Therefore, the step one towards the aim is Part one; it is a tutorial including both the documentations and practices of the most required C functions in the socket programs. One of the objectives in this project is achieved in this part.

Part two assigned to point out a reference information with practices on programming of C language under UNIX environment, and providing description to the most common command needed for C language development. Another objective attained in this part.

Part three is the technical approach to implement the main goal of this project by making use of the practices done in the previous two parts and the algorithms given in this part. So the aim specified for this project were completed in this part by successfully writing Internet socket programs for the client and server, in addition to many successful enhanced socket programs.

It is preferable for the beginners and any one starts learning internet socket, to go through Part 1 and 2, as these parts are giving sufficient training in C programming on Unix, then he will find a new method to learn how to write socket programs, by using basic template for each socket type program after that he will see this technique is very helpful in enhancement procedures.

Aims and Objectives

Aims

The aim of this project is to write Internet socket programs for the Client and Server in C language using UNIX operating system as a platform. Then suggesting some enhancement to these simple programs make them more efficient or to meet some requirement design.

Objectives

  1. Learn programming in C language

  2. Learn how to use UNIX and its commands in writing C programs

  3. Learn the basics of socket programming

  4. Study examples of socket programs, TCP communication, and UDP communication

Deliverables

  1. User manual for learning C language and software development.

  2. User manual to program in C under UNIX

  3. User manual for understanding and programming socket programs for the beginners.

  4. Client Server programs used as a Messenger and general-purpose socket programs.

  5. Logbook.

  6. Final project report.

Top


Designed by Nabeel Almulla 31 May 2005