Simple Client Server Chatting Application Information Technology Essay

With the rapid advances in the technology the network communication between different people has made much easier than one can expect. And the network is the heart of communication. Socket API Application program interface is the main utilization and which plays a important base for this purpose. The current application allows multiple users to communicate with each other which is enhanced to allow the socket application program interface. Thus communication mechanism makes much easier. Application allow different type of users to have communication mechanism by implementing a simple client to server communication for mutual chatting application. The objective of the chat server is to transfer messages reliably and efficiently, data and voice.

Chat server is a standalone application that is made up the combination of two-application, server application (which runs on server side) and client application (which runs on client side). This application is using for chatting in stand alone system using loop back network. Initially when we want to send a message to the client and every user a server should be connected.

1.1 Objective:

The aim of this project is to express how we can implement a simple chat application between a server and a client? The application is a console based application and is implemented using Linux BSD Sockets. The project is developed in C language executed on a single stand-alone Linux machine across a network using loop back address concept.

Application consists of two programs:

Server

Client

Server

The server module of the application waits for the client to connect to it. Then if connection is granted a client interacts communicates and connects to the server, it can mutually communicate with the server. The duty of the server is to let clients exchange the messages.

Client

The client module is the one that utilizer sends requests to the server. Utilizer utilizes the client as the means to connect to the server. Once he establishes the connection, he can communicate to the connected server.

1.2 Execution of the project:

Below are steps to create the development environment and execute the current project application:

Start Linux OS and let the kernel up.

Enter as any utilizer (preferably as root utilizer).

Open two consoles for developing the server and client applications.

Open the editors (VI editor) and edit the server and client application programs.

Compile and run the server program first and next the client program.

As per the client a request, the chat server act in response to the client and then chatting can be done between the two.

CHAPTER 2

BRIEF OUT ON SOCKET PROGRAMMING AND CLIENT – SERVER MODEL IN LINUX

2.1 Socket Types

Socket plays important role in programming initially when a socket has to define or when a socket is created the program has to describe or introduce the socket i.e socket type and socket address. If two sockets are in same domain and same type they are said to be that they can communicate each other.

Sockets are most widely used address domains i.e families and unix domain were both processes can share a common file system communication; and the Internet domain in which both the socket type and socket address are running on any two hosts on the Internet communicate. These are called as local sockets or network sockets .

In UNIX domain the address of socket is a character string which is initially entry in a file system

The low numbers are reserved in UNIX which are standard services. Basically standard services are kept on all PCs at the same port so the users or clients are much familiar with their address. Port number above 2000 can be used.

There are usually two types of socket stream sockets which are connection oriented, and datagram sockets which are connection less. All sockets are assumed by various port numbers on the host. Port numbers are generally 32 bit unsigned integers. Stream connection oriented socket are continuous flow of stream of characters, while connection less sockets are able to read the entire message at a time. Each socket utilizes its individual transportation protocol.

STREAM SOCKETS uses transmission protocol which are reliable and when we compared to DATAGRAM ORIENTED SOCKETS utilizing user protocol which are capable of using the linux. These sockets are message oriented and unreliable.

The current project sockets utilizes the Internet domain (or family) using the TCP protocol.

2.2 The client server model

 

Client server model diagram

source: http://www.javaworld.com/javaworld/jw-10-2001/jw-1019-jxta.html

Most inter process communication (IPC) utilizes the client servers. There are two types of inter process communication one is client process and the other server process in which both process will communicate with each other at any time and any were in the network. Generally client is on one side of process and server is attached with some basic data and information. So that the client and server can communication and exchange their data and information based on inter process model. For example, a user or person making phone call to other user or person

Client has to note the address of the server were it is to connect with it and communicate and whereas server doesn’t need any address location and presence to communication because the server is already in network therefore a connection is established between client and server.

Once a connection is established between both process client and server can send and receive information and data. The application program interface usually introduces and establishes a different connection between client and server, but both utilize the basic construction of socket. A socket is known as one end of an inter process communication (IPC) channel.

The two processes set up’s their own socket.

Following are the steps for establishing a socket on client side:

Initially Creating a socket with the socket() API

connect() API is used to connect the socket to the address of the server

read () and write () APIs are used for processing the data i.e. the data can be send and receive in simple way

Following are the steps for establishing a socket on the server side:

socket() API is initially creates a socket

Bind () API is used to bind the socket to a particular address on a server socket on the Internet. Since, address consists of port number IP port on the host.

listen() API listen application program interface is used for listen to the conection.

Agree to () API this socket is used for agree to the connection. Generally the connection is restricted until client connects and communicates with the server

Receiving and sending of data.

CHAPTER 3

BRIEF TUTORIALS ON CHAT SERVER AND CLIENT

3.1 Chat Server

In general chat server is an application that does the following:

Listens requests for incoming calls from clients.

Listens messages from all the connected clients.

Broadcasts the messages from clients to all the clients connected in the server.

Also we can type-in messages in the server that will be broadcasted to all the clients.

3.2 Chat Client

Chat client does the following:

Sends messages to server as well as to all the connected clients in the network.

Also views the messages from all the clients and server.

CHAPTER 4

SOCKETS IN DETAIL WITH REFERENCE TO LINUX INTERNALS

4.1 Sockets

The basic dissimilarity between a “server” socket and a “client” socket is more like on and off switch. When a network is established connection is fluctuated. The client application for example our browser network uses the client, where as web servers are mainly used to communicate with the client sockets and server sockets. Sockets can communicate with more than one user for establishing a connection.

Sockets are considerably the most popular of different forms of inter process communication. On any type of particular platform there are more than one that is it has multiple forms of inter process communication which are rapid fast and easy. But for external communication only single platform is used by the socket.[d]

4.2 How to create a Socket

  Syntax

  #include <sys/types.h>

  #include <sys/socket.h>

  int socket(int address_family,

int type,

int protocol)

  Service Program Name: QSOSRV1

  Default Public Authority: *USE

It appears as following

#create an INET, STREAMing socket s = socket. Socket (socket.AF_INET, socket.SOCK_STREAM)

#web server is attached on port number 80

# – is normal http port s.connect (“www.mcmillan-inc.com”, 80)

While 1:

//connection are agreed from outside

(Clientsocket, address) = serversocket.agree to ()

#now does something with the clientsocket

#in this case, we’ll pretend this is a threaded server

Ct = client_thread (clientsocket)

Serversocket.listen

ct.run ()

There are generally 3 ways in which this loop could work – create a new process client socket, dispatching a thread client socket or restructure this application to approach a unblocked socket and cross multiply between our client socket and server socket which is used bye a select. The basic essential thing to understand is all about server socket is. It doesn’t accomplish any communication. Just it generates “client” sockets. Sockets can be used from one host to other host connection. Listening a socket tells that a socket is waiting for a next connection The receiver then gets an indication that there is a new connection. It generates a new socket which represents the new connection. It then does a recv to receive data from the connection. The sender after returning from the connect call uses the send call to send data to the receiver. After creating a client socket we wait for new call and we listen to more connection. clients are allocated port with dynamism which will be indicates the sockets which is going to transmit the exchange data. Using a connect() each client socket uses a port number to communicate with other port number. sockets are then bind to agree and utilize the connection.

Read also  Methodology Of Dicta Travel Agency Information Technology Essay

Only one socket is used for one transfer basically http protocol. Initially client sends a request and then reads a reply. Client can detect the end of the report as it receives zero bytes that is it is said to be the socket is disabled.

But if you plan to reutilize your socket for further transfers, you have to assume that there is no End of Transfer on a socket. The connection has been broken if a socket receives or sends.

Assuming that if you do not want to end the connection, the easiest way of solution is a fixed length message:

Class mysocket:

”’demonstration for class only “

– coded for clarity, not efficiency”’

def __init__Stream(self, sock=None):

if sock is None:

self.sockect = socket.socket (

socket.AF_INET, socket.SOCK_STREAM)

else:

self.sock = sock

def connect(host, port):

self.sock.connectrec ((host, port))

def myreceive ():

msg = ”

while len(msg) < MSGLEN:

chunk = self.sock.receive (MSGLEN-len(msg))

if chunk == ”:

raise RuntimeError, \

“socket connection broken”

msg = msg + chunk

http://www.amk.ca/python/howto/sockets/

def my send (msg):

totalsent = 0

while totalsent < MSGLENGTH:

sent = self.sock.send (msg[total sent:],STREAM)

if sent == 0:

raise Runtime Error, \

“socket connection broken”

totalsent = totalsent + sent

return msg

Length () in a socket address which determines the string length and capable of sending code .codes can be used again for any message to send and receive data. String characters can only be used by pythons. Complexity of receiving a code is very high. The socket program enable to send a request and receive a reply .

The first character of the socket program is assumed as message type and this type is determine as length this is said to be easiest way of enhancement with this there are two types of receives which are the indicated as the length of the socket is placed at first character and other character is used to find a loop.[11]

Protocols are used to allow end to end multiple message which are sent back to back and you go on receive smaller size. you may end up reading the start of a following message. Once a message has been received you have to keep it aside and hold on it until it is needed.by this ypu can manipulate more complex and sender can get rid of everything which is determined in a single pass.

A message generally has length of 5 characters which has prefixed and it is more efficient and complex; because we cannot find it in a single receiver you may find it in different receivers. In the following socket network, you’ll get away with it; but if don’t utilize two receivers the code will definitely break in network loads. Unless to make it more strong there are two loops – the first loop basically determines the length of the string and the 2nd loop to get the message data part. If you use the existing route you get data and messages in smaller size.[11]

4.5 Portability alert:

UNIX is selected by working process with the files and even socket. So when compared to UNIX and windows, windows works only with socket files. Windows are often more complex for utilization of socket. In fact, on Windows usually utilizes the threads very much faster than expected with my sockets. In different enhancement the socket code has lot of difference in Unix and windows both works but they are similar. That’s the reason why we use the socket files.

4.6 Shutdown a Socket

Sockets are not directly closed strictly speaking sockets utilize to shutdown. Shutdown of sockets means in different ways it says that I may end process but still you can listen or says that am not listening. Thus we say that it is an optional way of thinking to shutdown. It depends on the argument you pass. The other way of utilizing the shutdown of socket means generally used in http protocol. When once client send a request and makes a shutdown this doesn’t mean that server can’t receive it still tells the server that client has done with sending a message and still it may receive. The server sends a eof by receiving some bytes and then server sends a reply. Whereas in case of pythons if socket is empty it sends back automatically defining it is very slow once the work is completed the socket must close immediately.

Shutdown () close () mostly includes the etiquette of closing of sockets but it reflects to bad habit. Most libraries are neglecting the utilization of threads. By this when errors are occurred sudden shutdown may needed.[11]

4.7 Blocking Sockets

Probably if suddenly one side of blocking socket is blocked what happens to the other end when suddenly its closed. Blocking socket may suddenly disappear. SOCKSTREAM is a dependable protocol which waits for a connection very long time. Socket after sometimes hanged If a socket threads are used, the entire thread is in actual fact it is dead. As long as if you are trying to lock the blocking read or entire blocking sockets it is safe, by this the assets are not really overridden. Socket streams are also able in blocking sockets which can listen to a socket. Threads are more capable of avoiding the overhead which is associated with automatic recycling with this protection you cannot try to kill the thread which are more capable of the process.

4.8 Non-blocking Sockets

Once understanding about the preceding of sockets you know what mechanics are used for non blocking of socket. You can still utilize the sockets in much similar way. It says that your application may be in the socket or outside the socket this has to been done before using a socket. set blocking(0) is used to create a non-blocking this is mostly used in pythons to utilize a socket. When compared to c language it is complex but not exactly the same.

The major difference between connect socket, sending a socket, receiving a socket and agree a socket can be returned without doing anything. And have a more option. After Verify return code and error codes. In future the application may grow higher rate, large and may reduce the CPU power.[11]

http://www.amk.ca/python/howto/sockets/

CHAPTER 5

SOCKET APIs AT CLIENT AND SERVER IN LINUX

5.1 socket API()

5.11 Client application program interface:

Socket () Application call

The socket Application call is specially used to create a socket. A socket is used to read and write from network communication.

In previous chapter it is mentioned that how to find an ip address for a host name and how we can get an port number for a service name.[5]

Following is the list of prototype for the socket () API:

int socket(int add_family,

int type,

int protocol)

This means that it agrees for three parameters and procedure to call is known as socket.

D socket 10I 0 ExtProtocol(‘socket’)

D protocol 10I 0 value

D _add 10I 0 value

D addr_family 1011 value

Protocol also precedes an integer. TCP and IP protocols can be used to realize in socket APIs. This networking protocol is very essential to utilize.TCP networking protocol uses the stream socket over internet domain. we already specified that TCP must use.

Presently we don’t know what integer values we are assigning to each socket protocol which are IPPROTO_IP which is the networking protocol for IP,AF_INET and SOCK STREAM are, socket stream are connection oriented, in some header files of C programming IBM is known for representing about some named constants, when a bit of snooping is done into system open which includes libraries these are defined as RPG in some particular case networking protocol ip is defined to 0, socket stream is defined as 1 and similarly af_net is defined to be 2. This tells us that this constants are named.[8]

D TCPPROTO-TCP C CONST(3)

D AF_INET C CONST(2

D SOCK_STREAM C CONST(1)

D IPPROTO_IP C CONST(0)

Finally socket () API look like,

s = socket(AF_INET:IPPROTO_IP:SOCK_STREAM)

2. connect () Application protocol interface call

Connect – connect means initializing a new connection on socket

SYNOPSIS

#include <sys/types.h>

#include <sys/socket.h>

int connect(int sockfd, struct sockaddr *serv_addr, int

addrlen);

int SOCK_DGRAM

Returning a value to 0 or 1

Once it is bind a socket or connected the value 0 is returned

Initially if we want to work on a socket we have to connect the socket to some other this connecting of socket is done by connect().Thus connect () prototype application program interface looks like as follows

int connect(int socket_destination

struct sockaddr *discriptor_address,

int address_length)

Following is the RPG prototype:

D connect PR 10I 0 ExtProc(‘connect’)

D sock_desc 10I 0 value

D dest_addr * value

D addr_len 10I 0 value

Socket address is defined as follows:

struct sockaddr {

u_short sa_family;

char sa_data[18];

};

The main idea of this socket structure is to tell the application program interface which port number and internet protocol to connect it. socket address includes the recognizing address domain family. sockaddr structure is known as generic structure. Address domain and generic data field can be placed in format of address. In socket address the data is character string. Socket address is generally represented as 18 bit unsigned integer.[10]

Read also  Main Features And Characteristics Information Technology Essay

Connect () application interface program is actually having a different socket structure called ‘sockaddr_in’. But this document is not attached in IBM’s page for connecting a network. Socket address is specially designed for internet address protocol. Each internet protocol has different format to how can a address can work. Basically c definition for sockaddr_in is found in file IPSOC which is internet protocol socket and this socket includes the socket library.

The following looks like as follows

struct sockaddr_in { /* socket address (internet) */

short struct_family; /* address family (AF_INET) */

u_short struct_port; /* port number is defined */

struct in_addr sin_addr; /* IP address */

char struct_zero[8]; /* reserved */

};

For better and more reliable utilization of the structures of RPG these structures should be made to use the same memory area. Sin family allocates the family address. This tells that we can use both the socksddr and sockaddr_in. The basic difference is the address can be moved without changing any data. Socket address is address of the socket which is determined.[8]

D p_sockaddr S

Connect () API is used for connecting a call so initially we have to approach the operating system for memory to store the socket address structure into call connect. Socketaddr_in is the structure which can be used into address

Socketaddr_in struct value 1011

3. Sending and receiving Application interface program calls

Basically we have to initiate a connection, so once we got a connection we can transfer data from sender to receiver over a network. For sending and receiving a data special sockets are designed which are send () API and receive () API.[c]

Send() API prototype is designed as

int send (int socket_destination,

char *buffer,

int buffer_length,

int flags)

This sending and receiving APIs have four parameters which are integer and parameters. Thus, the RPG prototype looks like:

D send PR 10I 0 ExtProc(‘send’)

D sock_desc 10I 0 value

D buffer * value

D buffer_len 10I 0 value

D flags 10I 0 value

‘char *’ definitions asa character string which is specific for family address, we put the ‘choices (*string)’ keyword in our D-specs. The buffer length has a values of 1010 and buffer_len is the buffer length which is defined a length of the socket buffer.flags are also used based on return values of o and 1.[17]

Consequently, we typically call the send () API like this:

D miscdata S 25A

C sin address is send

C eval miscdata = ‘The data to send goes here’

C eval rc = send (s: %addr(miscdata): 25: 0)

c if rc < 25

C* for some reason we weren’t able to send all 25 bytes!

C endif

Receive () API is utilized to receive data over the network. By the end of the discussion both send () and receive () prototype are similar only the difference is the name of the procedure.

Receive () API prototype is designed as

int receive (int socket_descriptor,

char *buffer,

int buffer_length,

int flags)

And, just like send, the RPG prototype looks like this:

D sock_desc 10I 0 value

D buffer * value

D buffer_len 10I 0 value

D flags 10I 0 value

D receive PR 10I 0 ExtProc(‘receive’)

Similar difference between the prototypes send () and receive () is the area of memory pointed to by the ‘buffer’ parameter. Send() basically writes data to the network and Receive() is the data read from the network.

receive () prototype always waits for the all the receiving bits it also waits for the even last bit if it delays because it has to wait for the previous buffer completion. If there are number of bytes to be send using a receive prototype it only takes upto the requested length and the other bytes are returned.[e]

Closing an Application Program Interface

Close () API call

The close socket indicates the disconnecting of a socket using close() API which is mostly used to disconnect a new connection and finally which may cause socket descriptor. For using a socket we have to call using call socket (). Closing an application may also indicates the connection is lost when it is in use.

The manual tells us that the prototype for close() looks like this:

int close(int files)

C eval rc = close(s)

C if rc < 0

C*** Socket didn’t close. Now what?

c endif

The parameter only has the one integer which used by close.

RPG prototype is designed as

D close PR 10I 0 ExtProc(‘close’)

D sock_desc 10I 0 value

To call it we can simply to:

D close PR 10I 0 ExtProc(‘close’)

D sock_desc 10I 0 value

If the close() application interface program is closed it looks like

C call close(s)

Close () API is used for closing the socket. We have to define only one prototype for closing a connection which is read socket or write socket in a particular program.

Before compiling a close socket there should be without any errors and it should be defined as perfectly. [e]

unlink() – delete a name and possibly the file it refers to

SYNOPSIS

#include <unistd.h>

int unlink(const char *pathname);

DESCRIPTION

Unlink is specifically used for deleting a path name from the file system. If pathname is the last file and further process is done then the entire file is deleted and the memory used for the previous file is again re utilized.

If the name specified with a socket, FIFO FIRST IN FIRST OUT or name for it is detached but procedures which have the object open might continue to utilize it.

Return value

If error is set to -1 it is returned and if it is 0 it is set properly

Server Application APIs

To create a server application using the BSD interface, you must follow these steps:

Form a new socket by typing socket ().

Bind IP addresses and port number to the socket by typing: bind. This step recognizes the server so that the client knows where to go.

New connection requests can be identified and listen on the socket by typing listen ().

Agree to new connections by typing accept ().

http://en.wikipedia.org/wiki/Berkeley_sockets

1. Socket () – create an endpoint for communication

SYNOPSIS

#include <sys/types.h>

#include <sys/socket.h>

int socket(int domain, int type, int protocol);

DESCRIPTION

In this case a socket is created at end points for communication and then it returns a descriptor file.

Return value if -1 is occurred treated as error and retransmits if 0 it is sent to descriptor.

bind – bind a name to a socket

SYNOPSIS

#include <sys/types.h>

#include <sys/socket.h>

int bind (int sockfd, struct sockaddr *my_addr, int Addrlen);

DESCRIPTION:

Bind gives the socket sockfd the local address my_addr. My_addr is addrlen. Conventionally, it’s called as “assigning a name to a socket.”

RETURN VALUE:-

On success it returns 0. On error, -1 is returned, and error o is set correctly.

3. Listen () – listen for connections on a socket

SYNOPSIS

#include <sys/socket.h>

int listen(int s, int backlog);

DESCRIPTION

Initially a socket is created by a connection. Listen socket is used for new connection. Once a connection is established a new connection is agreed by a listen socket which retransmits the original protocol

Linux 2.2 changes the nature of the backlog parameter on TCP socket connection. These specifies the length of the queue which is waiting to be agree toed, as an alternative the number of in absolute connection requests. The maximum length of the backlog socket is max_tcp_systl_MSG. backlog parameter is initially agrees a connection. These all parameters comes are the socket parameters.

RETURN VALUE:-

On success it returns 0. On error, -1 is returned, and error o is set correctly.

4. Accept () – agree to a connection on a socket

SYNOPSIS

#include <sys/types.h>

#include <sys/socket.h>

int agree to(int s, struct sockaddr *addr, int *addrlen);

DESCRIPTION

In this argument the accept socket accepts the connection only from the non-blocking socket. If the sockets are blocked it doesn’t agree the connection it may cause errors. The integer function s is the socket address which is designed to have a socket address. Agree of new connection is based on accept and decline status. This socket creates a new file descriptor for the socket.[17]

CHAPTER 6

NETWORK BYTE ORDERING APIs

The below list shows the different network byte order application program interface (APIs) which are utilized in the application program to convert the internet protocol address from host to the network byte order and from network byte order to host which are understandable.

Synopsis

# include <net/in.h>

Unsigned long int htlng (unsigned long int host long);

Unsigned short int htsht (unsigned short int host short);

Unsigned long int ntlng (unsigned long int net long);

Unsigned short int ntsht (unsigned short int net short);

DESCRIPTION

htlng stands for host long this function alters the long integer host from network byte order to the host byte order.

htsht stands for short host which is used for the alteration of short integer host from network byte order to the host byte order and vice versa.

Int ntlng is a unsigned integer it stands for netlong which is aused to alter the long int net long from host byte order to network byte order.

Int ntsht is a unsigned integer net short which also alter from host byte to network byte. This is a unsigned short integer net short.

Least significant byte is classified first on 80 x 86 which is the significant host byte and whereas the network byte is mostly utilized on the internet communication. Most significant byte is generally utilized for the integer values which are used on internet.[11]

Read also  What Are Web Services Information Technology Essay

CHAPTER 7

COMPARISION OF TCP, IP AND UDP

The current project is based on TCP – Transmission Control Protocol

7.1 Transmission Control Protocol

TCP stands for transmission control protocol which was designed to provide a reliable connection from one end to other end byte stream over an unreliable internetwork. TCP has a connection between protocols ports on hosts. TCP delivers correct data from client to server. In TCP the connection is not lost and network is continuous. TCP makes the client program very strong.

TCP connection cannot be lost once the connection is lost it retransmits the data. When data is sent properly it receives an acknowledgement. TCP transmits the continuous stream of data between two hosts. Different network is used for different topology based on bandwidth. The parameters are different for each and every network. Each stream is divided into different byte and bytes left are reassembled the data. This makes the programmer strong without the lose of data.TCP recovers data that is delivered, damaged or lost. Once the acknowledgement is not received TCP retransmits the segment.[g]

TCP generally established under RFC793. Due to this different errors were detected and requirements were changed in some areas. If data is to large in TCP it splits and sends to the other end the other side it collects all the data and them reassembles. It also contains congestion flow.

TCP entity is used by each and every user and is mostly placed on each library. So each library contains a transport entity or a kernel is used. Interfaces and streams are usually managed

with Transmission control protocol to the internet protocol layer. Below 64 kb is the maximum capacity of a user data that is sent from local processes which breaks down into very small.

Two end points of a sender and receiver is obtained at the TCP connection called as sockets. Each and every socket has a IP address and port number. Each TCP delivered receives an acknowledgement. TCP entity is clearly discussed. A window is indicated to send how much data in the next attempt. Each 16 bit is unsigned to each bit. Each single socket can be connected multiple times in the network and sometimes they may collapse the connection at a time. Each connection is identified by using some socket identifiers which are socket1, socket2socket3, socket4…. Etc.

UDP

UDP is established under RFC768 which is known as connectionless protocol. It sends the datagram over the internet layer without the connection. UDP stands for user data protocol each segment in UDP has a 8-byte header. End points are designed between source port and destination port.UDP is just used over IP layer. Source port is used for the reply which is sent back to source. This header format is most probably used from source to destination port. This both protocols are most widely used. UDP doesn’t have any handshaking between sender and receiver.[g]

Each user data protocol can be handled independently of other. UDP has a small segment of 8 byte which can add delay at sender and receiver. Moreover there is no congestion control at UDP so that it can blast as it desired.

Transmission control protocol maintains the generic information about window size, destination number, sequence number and control bits.

Computer networks by William stalling

Following is the structure of TCP header

7.2 TCP header format

TCP segment consists of 20 byte header. Following are the header options which consists of source and destination port, sequence no. and ack no, TCP checksum… etc. both control messages and acknowledge are used in user data.

Source port

Source port identifies the end to end connection which is used for sending the information and control messages.

Destination port

Destination port is similar to the end point connection used for receiving the control messages and data.

Sequence number

Sequence number field performs the data usual function which specifies the stream of data for the next expected byte. TCP streams have 32bit data.

Acknowledgment number

ACK is the acknowledgement number which is used for the verification of sent data. If bit value is 1 ACK is said to be true and if bit value is 0 ACK is false which is under process or ignored.

Data offset

Data off set is measured segments of bytes which are measured at start of segment

Flags

This field controls the bit segment

PSH

PSH stands for pushed bit it tell the data to buffer in a continuous flow which sends a request the applicant to send data

RST

RST is used for reset a connection or to refuse opening a new connection.

SYN

SYN is used to synchronize the acknowledgement bit. SYN initiates a connection and then waits for acknowledgement once ACK is down it begins the transmission.

FIN

FIN bit is basically applying for a release of new connection. Once the sending data is finished it has no more data to transmit which say it is at end of stream.

Window

The window size indicates based on the sender. Sender decides how many bytes to be sent. It also known as the amount of data that a receiver can agree.

Checksum

Checksum is done for more reliability, it checksums the header data while performing computation. TCP checksum is made zero data is padded out if the length is in odd number. A 16 bit is signed to ones compliment.[g]

CHAPTER 8

VERSIONS OF LINUX

The present project utilizes Linux platform with C programming.

In this section we discuss about the various versions of linux which are seen throughout the network and how we refer as. Linus Torvalds has the general and basic idea of release of Linux. Linux release is circulated by kernel.org as the most important significant release. These appropriate release of Linux are called Linux 2.4 and Linux 2.6.6…..Etc.

But every user cannot access to these releases of Linux version. People make alteration of Linux version and make them how to use this is an alternative method. Users mostly refer to the version of Linux which is Linux 2.6.6 only. Red hat version of Linux which are seen is unfortunately utilizes a plain number as suffix Linux 2.6.6-12. It would have better if they utilize somewhat more explicitly RED HAT such as Linux 2.6.6 – rh 12.

In this presentation Linux represents the kernel when we got an idea and whenever we think about the operating system called Linux at this point situation gets more difficult. Two types of address domains are distinguished or families are discussed the domains or families the Unix or Linux domain or family in this type of file sharing system its easy to communicate and they share a common file and the internet . In this type of Linux they share two hosts to communicate. These are called otherwise local sockets and network sockets respectively. Each and every network socket has its own port number and address format.[2]

8.1 Linux2.4 to Linux2.6:

The present project utilizes Linux2.6 kernel:

The biggest change to LKMs among Linux2.4 and Linux2.6 is an internal one: LKMS are much differently loaded. Kernel does the linking in Linux 2.6. ELF kernel is directly done by stuffing an object into Linux. ELF object basically contains more information. So that there is a new entire package of utilizing the Linux 2.4 because of additional data and message this can be send through a special object so at last there is a new mode of package. It is an insignificant program, as evaluated to the full version of the Linux 2.4.[a]

There is a lot of difference on file including an LKM but users just find the suffix has changed because most probably they are having huge level of tools manage the LKMs and moreover they won’t is the interface has been changed.

ELF object (.o) file is the interpret used by the user in Linux and perform all the work of linking it to the running kernel an they produce a binary objet file. Object file is the file having main characters of string. Thus program perform a kernel and is stick to the memory. However KLM is not much reliable and cannot be build at some extent. To make a kernel file stronger we should start from basic .o file. And then run the program mod which is running the program with Linux source code. Kernel thus illustrates the .o file to some additional extent. It illustrates this .mod file because typically consist of “.mod”.[3]

Now compiling the .mod file and when the result are out it linkups with the outcome of the original .o file. Once it liked up the output will formulate to .o file to .ko file. Set the name with a -D compile choice when you compile the .mod file that locate the KBUILD_MODNAME macro.

www.linuxforum.net/books/LinuxKInt.pdf

LKM looks drastically harder in some certain situation. For example one of the inputs of the kernel is Linux 2.4. mod file was then determined and was passed to kernel. In smod’s -o choice told it clearly what to utilize for the LKM instance name.. The name is ingredient of the ELF object (.o file) that passed to the kernel. [2]

Order Now

Order Now

Type of Paper
Subject
Deadline
Number of Pages
(275 words)