Beruflich Dokumente
Kultur Dokumente
LIST OF EXPERIMENTS
1. Socket Programming
a. TCP Sockets
b. UDP Sockets
Processor :Pentium IV
RAM :256 MB
SOFTWARE REQUIREMENTS
Language :C/C++
Ex.no:1 CLIENT-SERVER CHAT PROGRAM
Date: USING TCP
AIM
ALGORITHM
SERVER
Step 1: Start the program.
Step 2: Create an unnamed socket for the server using the
parameters AF_INET as domain and the SOCK_STREAM as type.
Step 3: Name the socket using bind( ) system call with the
parameters server_sockfd and the server address(sin_addr and sin_sport).
Step 4: Create a connection queue and wait for clients using the listen( ) system call
with the number of clients request as parameters.
Step 5: Accept the connection using accept( ) system call when client requests for
connection.
Step 6: Get the message which has to be sent to the client and check that it is not
equal to ‘Bye’.
Step 7: If the message is not equal to ‘Bye’ then write the message to the client and
Goto step 6.
Step 8: If the message is ‘Bye’ then terminate the Process.
Step 9: Stop the program execution.
CLIENT
Step 1: Start the program.
Step 2: Create an unnamed socket for client using socket( ) system.
Step 3: Call with parameters AF_INET as domain and SOCK_STREAM as type.
Step 4: Name the socket using bind( ) system call.
Step 5: Now connect the socket to server using connect( ) system call.
Step 6: Read the message from the server socket and compare it with ‘Bye’.
Step 7: If the message is not equal to ‘Bye’ then print the message to the server
output device and repeat the steps 6 & 7.
Step 8: Get the message from the client side.
Step 9: Write the message to server sockfd and goto step 4.
Step 10:If the message is equal to ‘Bye’then print good bye message and terminate
the process.
Step 11:Stop the process.
CLIENT SERVER CHAT USING TCP
SERVER
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<string.h>
main()
{
int sd,sd2,nsd,clilen,sport,len;
char sendmsg[20],rcvmsg[20];
struct sockaddr_in servaddr,cliaddr;
printf("Enter the Server port");
printf("\n_____________________\n");
scanf("%d",&sport);
sd=socket(AF_INET,SOCK_STREAM,0);
if(sd<0)
printf("Can't Create \n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(sport);
sd2=bind(sd,(struct sockaddr*)&servaddr,sizeof(servaddr));
if(sd2<0)
printf(" Can't Bind\n");
else
printf("\n Binded\n");
listen(sd,5);
clilen=sizeof(cliaddr);
nsd=accept(sd,(struct sockaddr*)&cliaddr,&clilen);
if(nsd<0)
printf("Can't Accept\n");
else
printf("Accepted\n");
printf("\nReceived Messages\n");
do
{
recv(nsd,rcvmsg,20,0);
printf("%s",rcvmsg);
fgets(sendmsg,20,stdin);
len=strlen(sendmsg);
sendmsg[len-1]='\0';
send(nsd,sendmsg,20,0);
wait(20);
}
while(strcmp(sendmsg,"bye")!=0);
}
CLIENT
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
main()
{
int csd,cport,len;
char sendmsg[20],revmsg[20];
struct sockaddr_in servaddr;
printf("Enter the port\n");
scanf("%d",&cport);
csd=socket(AF_INET,SOCK_STREAM,0);
if(csd<0)
printf("Can't Create\n");
else
printf("Scocket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(cport);
if(connect(csd,(struct sockaddr*)&servaddr,sizeof(servaddr))<0)
printf("Can't Connect\n");
else
printf("Connected\n");
do
{
fgets(sendmsg,20,stdin);
len=strlen(sendmsg);
sendmsg[len-1]='\0';
send(csd,sendmsg,20,0);
wait(20);
recv(csd,revmsg,20,0);
printf("%s",revmsg);
}
while(strcmp(revmsg,"bye")!=0);
}
OUTPUT:
Client Side
Server Side
RESULT
Thus the C program for chat using TCP is executed and the output is verified
successfully
Ex.no:2 CLIENT-SERVER CHAT USING UDP
Date:
AIM
To write a C program for implementing chat program using UDP.
ALGORITHM
SERVER
CLIENT
Step 1: Start the program.
Step 2: Create an unnamed socket for client using socket
Step 3: Call with parameters AF_INET as domain an
SOCK_DGRAM as type.
Step 4: Name the socket using bind( ) system call.
Step 5: The Sendto( ) system call is used to deliver the
Message to the server.
Step 6: Stop the program execution.
CLIENT SERVER CHAT USING UDP
SERVER
#include<stdio.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
main()
{
struct sockaddr_in sadd,cadd;
int id,a,b,len,port;
char rbuff[100];
id=socket(PF_INET,SOCK_DGRAM,0);
if(id<0)
printf("Can't Create\n");
else
printf("Created\n");
printf("Enter the port Address\n");
printf("____________________\n");
scanf("%d",&port);
sadd.sin_family=PF_INET;
sadd.sin_addr.s_addr=htonl(INADDR_ANY);
sadd.sin_port=htons(port);
b=bind(id,(struct sockaddr*)&sadd,sizeof(sadd));
if(b<0)
printf("Can't Bind");
else
printf("Binded\n");
printf("~~~~~~\n");
len=sizeof(cadd);
if(recvfrom(id,rbuff,sizeof(rbuff),0,(struct sockaddr*)&cadd,&len)<0)
printf("Received Error\n");
else
printf("Server received =%s\n",rbuff);
close(id);
}
CLIENT
#include<stdio.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netinet/in.h>
main()
{
struct sockaddr_in sadd,cadd;
int id,len,n,c,s,b,port;
char str[100],serstr[100];
id=socket(PF_INET,SOCK_DGRAM,0);
if(id<0)
printf("Can't Create\n");
else
printf("Socket is Created\n");
printf("Enter the IP address\n");
scanf("%s",serstr);
printf("Enter the port Address\n");
scanf("%d",&port);
cadd.sin_family=PF_INET;
cadd.sin_addr.s_addr=inet_addr(serstr);
cadd.sin_port=htons(port);
printf("Enter the Data\n");
scanf("%s",str);
b=bind(id,(struct sockaddr*)&cadd,sizeof(cadd));
if(sendto(id,str,sizeof(str),0,(struct sockaddr*)&cadd,sizeof(cadd))<0)
printf("Transmit Error");
else
printf("Server Transmitted=%s\n",str);
close(id);
}
OUTPUT:
Client Side
Server Side
RESULT
Thus the C program for chat using UDP is executed and the output is verified
successfully.
Ex. No. 3a PRINTING THE CLIENT ADDRESS
Date: AT THE SERVER END
AIM
To write a C program for printing the client address at the server end.
ALGORITHM
SERVER
Step 1: Start the program.
Step 2: Create an unnamed socket for the server using the
parameters AF_INET as domain and the SOCK_STREAM as type.
Step 3: Name the socket using bind( ) system call with the
parameters server_sockfd and the server address(sin_addr and sin_sport).
Step 4: Create a connection queue and wait for clients
using the listen( ) system call with the number of clients request as
parameters.
Step 5: Accept the connection using accept( ) system call when client requests for
connection.
Step 6: If the descriptor is less than zero,then the connection is not established and
the stop the process.
Step 7: Print the IP address sent by the client to the server.
Step 8: Stop the program execution.
CLIENT
SERVER
#include<stdio.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<string.h>
main()
{
int sd,sd2,nsd,clilen,sport,len;
char sendmsg[20],rcvmsg[20];
struct sockaddr_in servaddr,cliaddr;
printf("Enter the Port\n");
scanf("%d",&sport);
sd=socket(AF_INET,SOCK_STREAM,0);
if(sd<0)
printf("Can't Create \n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=inet_addr("172.15.170.104");
servaddr.sin_port=htons(sport);
sd2=bind(sd,(struct sockaddr*)&servaddr,sizeof(servaddr));
if(sd2<0)
printf(" Can't Bind\n");
else
printf("\n Binded\n");
listen(sd,5);
clilen=sizeof(cliaddr);
nsd=accept(sd,(struct sockaddr*)&cliaddr,&clilen);
if(nsd<0)
printf("Can't Accept\n");
else
printf("Accepted\n");
printf("The Client Address is %s",inet_ntoa(cliaddr.sin_addr.s_addr));
}
CLIENT
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
main()
{
int csd,cport,len;
char sendmsg[20],revmsg[20];
struct sockaddr_in servaddr;
printf("Enter the port\n");
scanf("%d",&cport);
csd=socket(AF_INET,SOCK_STREAM,0);
if(csd<0)
printf("Can't Create\n");
else
printf("Scocket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=inet_addr("172.15.170.104");
servaddr.sin_port=htons(cport);
if(connect(csd,(struct sockaddr*)&servaddr,sizeof(servaddr))<0)
printf("Can't Connect\n");
else
printf("Connected\n");
}
OUTPUT:
Client Side
Server Side
RESULT
Thus the C program for printing the client IP Address at the server end is executed
and the output is verified successfully.
Ex.no: 3b DATE-TIME SERVER
Date:
AIM
To write a C program for implementing the simple TCP client-server where the
server acts as a Date-Time server.
ALGORITHM
SERVER
Step 1 :Start the program
Step 2 :Create an unnamed socket for the server using parameters AF_INET as
domain and SOCK_STREAM as type.
Step 3 : Declare the time variables t.
Step 4 :Get the server port number.
Step 5 :Register the host address to the system by using bind() system call in server
side.
Step 6 :Create a connection queue and wait for clients using listen() system call with
The number of clients requests as parameter.
Step 7 :Accept the connection using accept( ) system call when the client
request for connection.
Step 8 :Stop the Program execution.
CLIENT
Step 1 :Start the program.
Step 2 :Create an unnamed socket for the client using parameters AF_INET as
domain and SOCK_STREAM as type.
Step 3 :Get the client port number.
Step 4 :Now connect the socket to server using connect( ) system call.
Step 5 :The recv() system call gets the response of Date-Time request from the
server.
Step 6 :Print the date and time
Step 7 :Stop the program.
DISPLAYING TIME AT THE CLIENT END
SERVER
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<string.h>
#include<time.h>
main()
{
int sd,sd2,nsd,clilen,sport,len;
char sendmsg[20],rcvmsg[20];
time_t t;
struct sockaddr_in servaddr,cliaddr;
printf("Enter the Port no\n");
scanf("%d",&sport);
sd=socket(AF_INET,SOCK_STREAM,0);
time(&t);
strcpy(sendmsg,ctime(&t));
printf("%s",sendmsg);
if(sd<0)
printf("Can't Create \n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(sport);
sd2=bind(sd,(struct sockaddr*)&servaddr,sizeof(servaddr));
if(sd2<0)
printf(" Can't Bind\n");
else
printf("\n Binded \n");
listen(sd,5);
clilen=sizeof(cliaddr);
nsd=accept(sd,(struct sockaddr*)&cliaddr,&clilen);
if(nsd<0)
printf("Can't Accept\n");
else
printf("Accepted\n");
send(nsd,sendmsg,100,0);
}
CLIENT
#include<stdio.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<stdlib.h>
#include<time.h>
main()
{
int csd,cport,len;
char revmsg[100];
struct sockaddr_in servaddr;
printf("Enter the port\n");
scanf("%d",&cport);
csd=socket(AF_INET,SOCK_STREAM,0);
if(csd<0)
printf("Can't Create\n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(cport);
if(connect(csd,(struct sockaddr*)&servaddr,sizeof(servaddr))<0)
printf("Connection error\n");
recv(csd,revmsg,100,0);
printf("%s\n",revmsg);
}
OUTPUT:
Client Side
Server Side
RESULT
Thus the C program for printing Date and time is executed and the output is verified
successfully.
Ex.no:3c FILE TRANSFER USING TCP
Date:
AIM:
To write a C program for transferring a file using TCP.
ALGORITHM:
SERVER:
CLIENT:
SERVER
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<string.h>
main()
{
FILE *fp;
int sd,newsd,ser,n,a,cli,pid,bd,port,clilen;
char name[100],fileread[100],fname[100],ch,file[100],rcv[100];
struct sockaddr_in servaddr,cliaddr;
printf("Enter the port address: ");
scanf("%d",&port);
sd=socket(AF_INET,SOCK_STREAM,0);
if(sd<0)
printf("Can't Create \n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(port);
a=sizeof(servaddr);
bd=bind(sd,(struct sockaddr*)&servaddr,a);
if(bd<0)
printf(" Can't Bind\n");
else
printf("\n Binded\n");
listen(sd,5);
clilen=sizeof(cliaddr);
newsd=accept(sd,(struct sockaddr*)&cliaddr,&clilen);
if(newsd<0)
printf("Can't Accept\n");
else
printf("Accepted\n");
n=recv(newsd,rcv,100,0);
rcv[n]='\0';
fp=fopen(rcv,"r");
if(fp==NULL)
{
send(newsd,"error",5,0);
close(newsd);
}
else
{
while(fgets(fileread,sizeof(fileread),fp))
{
if(send(newsd,fileread,sizeof(fileread),0)<0)
{
printf("Can't send\n");
}
sleep(1);
}
if(!fgets(fileread,sizeof(fileread),fp))
{
send(newsd,"completed",999999999,0);
}
return(0);
}
}
CLIENT
#include<stdio.h>
#include<sys/socket.h>
#include<netinet/in.h>
main()
{
FILE *fp;
int csd,n,ser,s,cli,cport,newsd;
char name[100],rcvmsg[100],rcvg[100],fname[100];
struct sockaddr_in servaddr;
printf("Enter the port");
scanf("%d",&cport);
csd=socket(AF_INET,SOCK_STREAM,0);
if(csd<0)
{
printf("Error...");
exit(0);
}
else
printf("Socket is Created...\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);servaddr.sin_port=htons(cport);
if(connect(csd,(struct sockaddr*)&servaddr,sizeof(servaddr))<0)
printf("Error in Connection...\n");
else
printf("Connected...\n");
printf("Enter the existing file name: ");
scanf("%s",name);
fp=fopen(fname,"w");
send(csd,name,sizeof(name),0);
while(1)
{
s=recv(csd,rcvg,100,0);
rcvg[s]='\0';
if(strcmp(rcvg,"error")==0)
printf("File is not Available...\n");
if(strcmp(rcvg,"completed")==0) {
printf("file is transferred...\n");
fclose(fp);
close(csd);
break;
}
else
fputs(rcvg,stdout);
fprintf(fp,"%s",rcvg);
}
}
OUTPUT:
Server Side
Client Side
RESULT
Thus the C program for transferring file from one machine to another machine
using TCP is executed and the output is verified successfully.
EX.NO:4 SIMULATION OF SLIDING WINDOW
PROTOCOL
DATE:
AIM
To write a C program for the simulation of Sliding Window Protocol.
ALGORITHM
SENDER
RECEIVER
listen(sd,5);
clilen=sizeof(cliaddr);
newsd=accept(sd,(struct sockaddr*)&cliaddr,&clilen);
if(newsd<0)
printf("Can't Accept\n");
else
printf("Accepted\n");
}
CLIENT
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<string.h>
main()
{
int i,sd,n,port;
char sendmsg[100],recvmsg[100];
struct sockaddr_in servaddr;
printf("Enter the port\n");
scanf("%d",&port);
sd=socket(AF_INET,SOCK_STREAM,0);
if(sd<0)
printf("Can't Create\n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(port);
if(connect(sd,(struct sockaddr*)&servaddr,sizeof(servaddr))<0)
printf("Can't Connect\n");
else
printf("Connected\n");
printf("Enter the no of frames\n");
scanf("%d",&n);
printf("\nThe frames all\n");
for(i=1;i<=n;i++)
printf("Frame %d\n",i);
recv(sd,recvmsg,20,0);
printf("\n Lost frame %s is retransmitted ",recvmsg);
strcpy(sendmsg,recvmsg);
send(sd,sendmsg,20,0);
}
OUTPUT:
Server:
[1me16alhost~]: VI swserver.c
[1me16alhost~]: CC swserver.c
[1me16alhost~]: /a.out
Socket is created
Binded
Accepted
Client:
[1me16alhost~]: VI swclient.c
[1me16alhost~]: CC swclient.c
[1me16alhost~]: /a.out
Socket is created
Connected…………..
RESULT
Thus the C program for the simulation of Sliding Window Protocol has been
executed and the output is verified successfully.
EX.NO:5 DOMAIN NAME SYSTEM
DATE:
AIM
To write a C program for the simulation of Domain Name System
ALGORITHM
SERVER
Step 1: Start the program.
Step 2: Create the Socket for the Server.
Step 3: Bind the Socket to the Port.
Step 4: Listen for the incoming client connection.
Step 5: Receive the IP address from the client to be resolved.
Step 6: Get the domain name from the client.
Step 7: Check the existence of the domain in the server.
Step 8: If domain matches then send the corresponding address to the client.
Step 9: Stop the program execution.
CLIENT
SERVER
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<string.h>
main()
{
int sd,sd2,nsd,clilen,sport,len,i;
char sendmsg[20],recvmsg[20];
char ipid[20][20]={"172.15.64.66","172.15.44.55","172.15.33.44","172.15.22.33"};
char hostid[20][20]={"www.yahoo.com","www.google.com","www.hotmail.com"};
struct sockaddr_in servaddr,cliaddr;
printf("DNS Server Side\n");
printf("Enter the Port\n");
scanf("%d",&sport);
sd=socket(AF_INET,SOCK_STREAM,0);
if(sd<0)
printf("Can't Create \n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(sport);
sd2=bind(sd,(struct sockaddr*)&servaddr,sizeof(servaddr));
if(sd2<0)
printf("Can't Bind\n");
else
printf("\n Binded\n");
listen(sd,5);
clilen=sizeof(cliaddr);
nsd=accept(sd,(struct sockaddr*)&cliaddr,&clilen);
if(nsd<0)
printf("Can't Accept\n");
else
printf("Accepted\n");
recv(nsd,recvmsg,20,0);
for(i=0;i<4;i++)
{
if(strcmp(recvmsg,hostid[i])==0)
{
send(nsd,ipid[i],20,20);
break; }}}
CLIENT
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
main()
{
int csd,cport,len;
char sendmsg[20],recvmsg[20];
struct sockaddr_in servaddr;
printf("DNS Client Side\n");
printf("Enter the Client port\n");
scanf("%d",&cport);
csd=socket(AF_INET,SOCK_STREAM,0);
if(csd<0)
printf("Can't Create\n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(cport);
if(connect(csd,(struct sockaddr*)&servaddr,sizeof(servaddr))<0)
printf("Can't Connect\n");
else
printf("Connected\n");
}
OUTPUT:
Server:
[1me16alhost~]: VI dnsserver.c
[1me16alhost~]: CC dnsserver.c
[1me16alhost~]: /a.out
Socket is created
Binded
Accepted
Client:
[1me16alhost~]: VI dnsclient.c
[1me16alhost~]: CC dnsclient.c
[1me16alhost~]: /a.out
Socket is created
Connected…………..
RESULT
Thus the C program for the simulation of Domain Name System has been executed
and the output is verified successfully.
EX.NO:6 SIMULATION OF ROUTING PROTOCOLS
DATE:
AIM
To Simulate Shortest Path Routing Algorithm
ALGORITHM
Step 1: Start the Program
Step 2: Create a distance list, a previous vertex list, a visited list, and a current vertex.
Step 3: All the values in the distance list are set to infinity except the starting vertex
which is set to zero.
Step 5: All values in the previous list are set to a special value signifying that they are
undefined.
Step 8: Update distance and previous lists based on those vertices which can be
immediately reached from the current vertex.
Step 9: Update the current vertex to the unvisited vertex that can be reached by the
shortest path from the starting vertex.
Step 10: Repeat (from step 6) until all nodes are visited.
#include<iostream.h>
#include<conio.h>
class dij
{
private:
int graph[15][15],source,no;
int set[15],predessor[15],mark[15],pathestimate[15];
public:
int minimum();
void read();
void initialize();
void printpath(int);
void algorithm();
void output();
};
void dij::read()
{
cout<<"Enter the no of vertices: ";
cin>>no;
cout<<"Enter the Adjacent matrices";
for(int i=1;i<=no;i++)
{
cout<<"Enter the weight for row: "<<i;
for(int j=1;j<=no;j++)
{
cin>>graph[i][j];
}
}
cout<<"Enter the source Vector: ";
cin>>source;
}
void dij::initialize()
{
for(int i=1;i<=no;i++)
{
mark[i]=0;
pathestimate[i]=999;
predessor[i]=0;
}
pathestimate[source]=0;
}
void dij::algorithm()
{
initialize();
int count=0,i,u;
while(count<no)
{
u=minimum();
set[++count]=u;
mark[u]=1;
for(int i=1;i<=no;i++)
{
if(graph[u][i]>0)
{
if(mark[i]!=1)
{
if(pathestimate[i]>pathestimate[u]+graph[u][i])
{
predessor[i]=u;
pathestimate[i]=pathestimate[u]+graph[u][i];
}
}
}
} //for loop
} //while loop
}
void dij::printpath(int i)
{
cout<<endl;
if(i==source)
{
cout<<source;
}
else if(predessor[i]==0)
cout<<"No path from"<<source<<"to"<<i;
else
{
printpath(predessor[i]);
cout<<"....."<<i;
}
}
void dij::output()
{
for(int i=1;i<=no;i++)
{
printpath(i);
if(pathestimate[i]!=999)
cout<<"->("<<pathestimate[i]<<")\n";
}
cout<<endl;
}
int dij::minimum()
{
int min=999,i,t;
for(i=1;i<=no;i++)
{
if(mark[i]!=1)
{
if(min>=pathestimate[i])
{
min = pathestimate[i];
t=i;
}
}
}
return t;
}
void main()
{
clrscr();
dij d;
d.read();
d.algorithm();
d.output();
getch();
}
OUTPUT
Enter the no of vertices: 3
Enter the Adjacent matrices
Enter the weight for row: 1
0
1
3
Enter the weight for row: 2
2
1
1
Enter the weight for row: 3
2
1
1
Enter the source vector: 1
1 -> (0)
1……. 2- > (1)
1…… 2 ……. 3 -> (1)
RESULT:
Thus the Program for simulating Shortest Path Routing Algorithm is executed
and the output is verified successfully.
EX.NO:6b UNIFORM RESOURCE LOCATOR (URL)
DATE:
AIM
ALGORITHM
Step 3: Specify the address from which the data is to be retrieved inside the URL class
Step 5: Request the content Length, modified date etc. using appropriate the methods.
CONTENT TYPE=text/html
Date:03-11-2010 time:15:13:28
<html>
<head>
<title>welcome</title>
<body bgcolor=”blue”>
<h1>welcome to network lab-1</h>
</body>
</html>
RESULT
Thus the program for retrieving the data using URL is executed and the output is
verified successfully.
Ex.No:8 MULTICLIENT-SERVER CHAT
Date:
AIM:
To write a C program for implementing Client-Server Chat using TCP.
ALGORITHM:
SERVER:
CLIENT:
SERVER
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<string.h>
main()
{
int i,sd,sd2,nsd,clilen,sport,len;
char sendmsg[20],rcvmsg[20];
struct sockaddr_in servaddr,cliaddr;
printf(“Enter the port no:\n”);
scanf("%d",&sport);
sd=socket(AF_INET,SOCK_STREAM,0);
if(sd<0)
printf("Can't Create \n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(sport);
sd2=bind(sd,(struct sockaddr*)&servaddr,sizeof(servaddr));
if(sd2<0)
printf("Can't Bind\n");
else
printf("\n Binded\n");
listen(sd,5);
do
{
printf("Enter the client no to communicate\n");
scanf("%d",&i);
if(i==0)
exit(0);
printf("Client %d is connected\n",i);
clilen=sizeof(cliaddr);
nsd=accept(sd,(struct sockaddr*)&cliaddr,&clilen);
if(nsd<0)
printf("Can't Accept\n");
else
printf("Accepted\n");
do
{
recv(nsd,rcvmsg,20,0);
printf("%s",rcvmsg);
fgets(sendmsg,20,stdin);
len=strlen(sendmsg);
sendmsg[len-1]='\0';
send(nsd,sendmsg,20,0);
wait(20);
}while(strcmp(sendmsg,"bye")!=0);
}while(i!=0);
}
CLIENT - 1
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
main()
{
int csd,cport,len;
char sendmsg[20],revmsg[20];
struct sockaddr_in servaddr;
printf("Enter the port no:\n");
scanf("%d",&cport);
csd=socket(AF_INET,SOCK_STREAM,0);
if(csd<0)
printf("Can't Create\n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(cport);
if(connect(csd,(struct sockaddr*)&servaddr,sizeof(servaddr))<0)
printf("Can't Connect\n");
else
printf("Connected\n");
do
{
fgets(sendmsg,20,stdin);
len=strlen(sendmsg);
sendmsg[len-1]='\0';
send(csd,sendmsg,20,0);
wait(20);
recv(csd,revmsg,20,0);
printf("%s",revmsg);
}
while(strcmp(revmsg,"bye")!=0);
}
CLIENT - 2
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
main()
{
int csd,cport,len;
char sendmsg[20],revmsg[20];
struct sockaddr_in servaddr;
printf("Enter the port no:\n");
scanf("%d",&cport);
csd=socket(AF_INET,SOCK_STREAM,0);
if(csd<0)
printf("Can't Create\n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(cport);
if(connect(csd,(struct sockaddr*)&servaddr,sizeof(servaddr))<0)
printf("Can't Connect\n");
else
printf("Connected\n");
do
{
fgets(sendmsg,20,stdin);
len=strlen(sendmsg);
sendmsg[len-1]='\0';
send(csd,sendmsg,20,0);
wait(20);
recv(csd,revmsg,20,0);
printf("%s",revmsg);
}
while(strcmp(revmsg,"bye")!=0);
}
OUTPUT:
SERVER SIDE:
socket is created
Binded
CLIENT SIDE 1:
Socket is created
Connected
hiiiiii
Byeeeee
CLIENT SIDE –2:
RESULT
Thus the C program for chat multiclient-serve chat program using tcp has been
executed successfully.
Ex. No:9 SIMULATION OF SIMPLE NETWORK
Date: MANAGEMENT PROTOCOLS
AIM:
To write a C program for simulation of Simple Network management Protocols.
ALGORITHM:
MANAGER:
AGENTS
Step 1: Start the program.
Step 2: Create an unnamed socket for the server using the parameters AF_INET as
domain and the SOCK_STREAM as type.
Step 3: Name the socket using bind( ) system call with the parameters server_sockfd
and the manager address(sin_addr and sin_sport).
Step 4: Create a connection queue and wait for manager using the listen ( ) system call
with the number of manager request as parameters.
Step 5: Accept the connection using accept( ) system call when manager requests for
connection.
Step 6: Receive the message from the manager. If the request is for „TCP connections‟
then send the details of the requested object, else if the request is for „System‟ then send
the details of the requested system.
Step 7: Stop the program execution.
SIMPLE NETWORK MANAGEMENT PROTOCOL
AGENT1
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<string.h>
main()
{
int i,sd,sd2,nsd,clilen,sport,len;
char sendmsg[20],recvmsg[100];
char oid[5][10]={"client1","client2","client3","cleint4","client5"};
char wsize[5][5]={"5","10","15","3","6"};
struct sockaddr_in servaddr,cliaddr;
printf("I'm the Agent - TCP Connection\n");
printf("\nEnter the Server port");
printf("\n_____________________\n");
scanf("%d",&sport);
sd=socket(AF_INET,SOCK_STREAM,0);
if(sd<0)
printf("Can't Create \n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(sport);
sd2=bind(sd,(struct sockaddr*)&servaddr,sizeof(servaddr));
if(sd2<0)
printf(" Can't Bind\n");
else
printf("\n Binded\n");
listen(sd,5);
clilen=sizeof(cliaddr);
nsd=accept(sd,(struct sockaddr*)&cliaddr,&clilen);
if(nsd<0)
printf("Can't Accept\n");
else
printf("Accepted\n");
recv(nsd,recvmsg,100,0);
for (i=0;i<5;i++)
{
if(strcmp(recvmsg,oid[i])==0)
{
send(nsd,wsize[i],100,0);
break;
}
}
}
AGENT 2
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<string.h>
main()
{
int i,sd,sd2,nsd,clilen,sport,len;
char sendmsg[20],recvmsg[100];
char oid[5][10]={"System1","System2","System3","System4","System5"};
char mdate[5][15]={"1-10-095","10-03-08","14.03.81","11.07.07","17.12.77"};
char time[5][15]={"9am","10pm","11am","12.30pm","11.30am"};
struct sockaddr_in servaddr,cliaddr;
printf("Enter the Server port");
printf("\n_____________________\n");
scanf("%d",&sport);
sd=socket(AF_INET,SOCK_STREAM,0);
if(sd<0)
printf("Can't Create \n");
else
printf("Socket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(sport);
sd2=bind(sd,(struct sockaddr*)&servaddr,sizeof(servaddr));
if(sd2<0)
printf(" Can't Bind\n");
else
printf("\n Binded\n");
listen(sd,5);
clilen=sizeof(cliaddr);
nsd=accept(sd,(struct sockaddr*)&cliaddr,&clilen);
if(nsd<0)
printf("Can't Accept\n");
else
printf("Accepted\n");
recv(nsd,recvmsg,100,0);
for(i=0;i<5;i++)
{
if(strcmp(recvmsg,oid[i])==0)
{
send(nsd,mdate[i],100,0);
send(nsd,time[i],100,0);
break;
}
}
}
MANAGER
#include<stdio.h>
#include<sys/types.h>
#include<netinet/in.h>
main()
{
int csd,cport,len,i;
char sendmsg[20],rcvmsg[100],rmsg[100],oid[100];
struct sockaddr_in servaddr;
printf("Enter the port\n");
scanf("%d",&cport);
csd=socket(AF_INET,SOCK_STREAM,0);
if(csd<0)
printf("Can't Create\n");
else
printf("Scocket is Created\n");
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(cport);
if(connect(csd,(struct sockaddr*)&servaddr,sizeof(servaddr))<0)
printf("Can't Connect\n");
else
printf("Connected\n");
printf("\n 1.TCP Connection\n");
printf("\n 2. System \n");
printf("Enter the number for the type of informtion needed....\n");
scanf("%d",&i);
if(i==1)
{
printf("Enter the Object ID for Client\n");
scanf("%s",oid);
send(csd,oid,100,0);
recv(csd,rmsg,100,0);
printf("\n The window size of %s is %s",oid,rmsg);
}
else
{
printf("\nEnter the Object ID for the System\n");
scanf("%s",oid);
send(csd,oid,100,0);
recv(csd,rmsg,100,0);
printf("\nThe Manufacturing date for %s is %s",oid,rmsg);
recv(csd,rmsg,100,0);
printf("\nThe time of Last Utilization for %s is %s",oid,rmsg);
}
}
OUTPUT:
AGENT1:
MANGER:
Socket is Created
Connected
1.TCP Connection
2. System
Enter the number for the type of information needed: 1
Enter the Object ID for Client: Client1
AGENT2:
Socket is Created
Connected
1.TCP Connection
2. System
Enter the number for the type of informtion needed: 2
Enter the Object ID for Client: System3
RESULT
Thus the C program for simple network management protocols has been executed
successfully.
EMAIL
#include <stdlib.h>
#include <string.h>
#define cknull(x) if((x)==NULL) {perror(""); exit(EXIT_FAILURE);}
#define cknltz(x) if((x)<0) {perror(""); exit(EXIT_FAILURE);}
#define LIST_LEN 4
//char *f="sam.txt";
void email_it(char *filename);
main()
{
char fname[15];
printf("enter the filename\n");
scanf("%s",fname);
email_it(fname);
}
for(i=0;*email_list[i]>0x0;i++)
{
cknull(strcpy(tmp, email_list[i]));
cknltz(sprintf (fpBuffer,"mail -s '%s %s' %s < %s",
"Please Review:", filename, tmp,filename));
if(system (fpBuffer)==(-1))
{
perror("email failure");
exit(EXIT_FAILURE);
}
}
}
OUTPUT:
RESULT
Thus the program for developing E-mail application is executed and the output is
verified successfully.
STUDY OF NETWORK SIMULATOR PACKAGES
INTRODUCTION:
NS is a discrete event simulator targeted at networking research. NS provides
substantial support for simulation of TCP, routing, and multicast protocols over wired
and wireless (local and satellite) networks. NS began as a variant of the REAL network
simulator in 1989 and has evolved substantially over the past few years. In 1995 ns
development was supported by DARPA through the VINT project at LBL, Xerox PARC,
UCB, and USC/ISI. Currently ns development is support through DARPA with SAMAN
and through NSF with CONSER, both in collaboration with other researchers including
ACIRI. NS has always included substantial contributions from other researchers,
including wireless code from the UCB Daedelus and CMU Monarch projects and Sun
Microsystems.
The network simulator ns-2 is a widely accepted discrete event network simulator,
actively used for wired and wireless network simulations. It has a highly detailed model
of the lower layers (Physical and MAC) of wireless IEEE 802.11 networks.
Ns-2 has also an emulation feature, i.e. the ability to introduce the simulator into a
live network and to simulate a desired network between real applications in real-time.
Within the scope of this project we developed some methods and extensions to
the ns-2 to combine wireless network simulation and network emulation.
OVERVIEW:
NS is an event driven network simulator developed at UC Berkeley that simulates
variety of IP networks. It implements network protocols such as TCP and UDP, traffic
source behavior such as FTP, Telnet, Web, CBR and VBR, router queue management
mechanism such as Drop Tail, RED and CBQ, routing algorithms such as Dijkstra, and
more. NS also implements multicasting and some of the MAC layer protocols for LAN
simulations. The NS project is now a part of the VINT project that develops tools for
simulation results display, analysis and converters that convert network topologies
generated by well-known generators to NS formats. Currently, NS (version 2) written in
C++ and OTcl (Tcl script language with Object-oriented extensions developed at MIT) is
available. This document talks briefly about the basic structure of NS, and explains in
detail how to use NS mostly by giving examples. Most of the figures that are used in
describing the NS basic structure and network components are from the 5th VINT/NS
Simulator Tutorial/Workshop slides and the NS Manual (formerly called "NS Notes and
Documentation"), modified little bit as needed.
Figure 1. Simplified User's View of NS
Figure 3 shows the general architecture of NS. In this figure a general user (not an
NS developer) can be thought of standing at the left bottom corner, designing and
running simulations in Tcl using the simulator objects in the OTcl library. The event
schedulers and most of the network components are implemented in C++ and available to
OTcl through an OTcl linkage that is implemented using tclcl. The whole thing together
makes NS, which is a OO extended Tcl interpreter with network simulator libraries.
This section briefly examined the general structure and architecture of NS. At this
point, one might be wondering about how to obtain NS simulation results.
As shown in Figure 1, when a simulation is finished, NS produces one or more
text-based output files that contain detailed simulation data, if specified to do so in the
input Tcl (or more specifically, OTcl) script. The data can be used for simulation analysis
(two simulation result analysis examples are presented in later sections) or as an input to
a graphical simulation display tool called Network Animator (NAM) that is developed as
a part of VINT project. NAM has a nice graphical user interface similar to that of a CD
player (play, fast forward, rewind, pause and so on), and also has a display speed
controller. Furthermore, it can graphically present information such as throughput and
number of packet drops at each link, although the graphical information cannot be used
for accurate simulation analysis.
This section shows a simple NS simulation script and explains what each line does.
Example 3 is an OTcl script that creates the simple network configuration and runs the
simulation scenario in Figure 4.
Most of member functions are for simulation setup and scheduling, however some of
them are for the NAM display. The "Simulator" object member function implementations
are located in the "ns-2/tcl/lib/ns-lib.tcl" file.
$ns color fid color: is to set color of the packets for a flow specified by the flow id
(fid). This member function of "Simulator" object is for the NAM display, and
has no effect on the actual simulation.
$ns namtrace-all file-descriptor: This member function tells the simulator to
record simulation traces in NAM input format. It also gives the file name that the
trace will be written to later by the command $ns flush-trace. Similarly, the
member function trace-all is for recording the simulation trace in a general
format.
proc finish {}: is called after this simulation is over by the command $ns at 5.0
"finish". In this function, post-simulation processes are specified.
set n0 [$ns node]: The member function node creates a node. A node in NS is
compound object made of address and port classifiers (described in a later
section). Users can create a node by separately creating an address and a port
classifier objects and connecting them together. However, this member function
of Simulator object makes the job easier. To see how a node is created, look at the
files: "ns-2/tcl/libs/ns-lib.tcl" and "ns-2/tcl/libs/ns-node.tcl".
$ns duplex-link node1 node2 bandwidth delay queue-type: creates two simplex
links of specified bandwidth and delay, and connects the two specified nodes. In
NS, the output queue of a node is implemented as a part of a link, therefore users
should specify the queue-type when creating links. In the above simulation script,
DropTail queue is used. If the reader wants to use a RED queue, simply replace
the word DropTail with RED. The NS implementation of a link is shown in a later
section. Like a node, a link is a compound object, and users can create its sub-
objects and connect them and the nodes. Link source codes can be found in "ns-
2/tcl/libs/ns-lib.tcl" and "ns-2/tcl/libs/ns-link.tcl" files. One thing to note is that
you can insert error modules in a link component to simulate a lossy link (actually
users can make and insert any network objects). Refer to the NS documentation to
find out how to do this.
$ns queue-limit node1 node2 number: This line sets the queue limit of the two
simplex links that connect node1 and node2 to the number specified. At this point,
the authors do not know how many of these kinds of member functions of
Simulator objects are available and what they are. Please take a look at "ns-
2/tcl/libs/ns-lib.tcl" and "ns-2/tcl/libs/ns-link.tcl", or NS documentation for more
information.
$ns duplex-link-op node1 node2 ...: The next couple of lines are used for the
NAM display. To see the effects of these lines, users can comment these lines out
and try the simulation.
Now that the basic network setup is done, the next thing to do is to setup traffic
agents such as TCP and UDP, traffic sources such as FTP and CBR, and attach them to
nodes and agents respectively.
set tcp [new Agent/TCP]: This line shows how to create a TCP agent. But in
general, users can create any agent or traffic sources in this way. Agents and
traffic sources are in fact basic objects (not compound objects), mostly
implemented in C++ and linked to OTcl. Therefore, there are no specific
Simulator object member functions that create these object instances. To create
agents or traffic sources, a user should know the class names these objects
(Agent/TCP, Agnet/TCPSink, Application/FTP and so on). This information can
be found in the NS documentation or partly in this documentation. But one
shortcut is to look at the "ns-2/tcl/libs/ns-default.tcl" file. This file contains the
default configurable parameter value settings for available network objects.
Therefore, it works as a good indicator of what kind of network objects are
available in NS and what are the configurable parameters.
$ns attach-agent node agent: The attach-agent member function attaches an agent
object created to a node object. Actually, what this function does is call the attach
member function of specified node, which attaches the given agent to itself.
Therefore, a user can do the same thing by, for example, $n0 attach $tcp.
$ns connect agent1 agent2: After two agents that will communicate with each
other are created, the next thing is to establish a logical network connection
between them. This line establishes a network connection by setting the
destination address to each others' network and port address pair.
Assuming that all the network configuration is done, the next thing to do is write a
simulation scenario (i.e. simulation scheduling). The Simulator object has many
scheduling member functions. However, the one that is mostly used is the following:
$ns at time "string": This member function of a Simulator object makes the
scheduler (scheduler_ is the variable that points the scheduler object created by
[new Scheduler] command at the beginning of the script) to schedule the
execution of the specified string at given simulation time. For example, $ns at 0.1
"$cbr start" will make the scheduler call a start member function of the CBR
traffic source object, which starts the CBR to transmit data. In NS, usually a
traffic source does not transmit actual data, but it notifies the underlying agent
that it has some amount of data to transmit, and the agent, just knowing how
much of the data to transfer, creates packets and sends them.
After all network configuration, scheduling and post-simulation procedure specifications
are done, the only thing left is to run the simulation. This is done by $ns run.
NETWORK COMPONENTS:
The root of the hierarchy is the TclObject class that is the superclass of all OTcl
library objects (scheduler, network components, timers and the other objects including
NAM related ones). As an ancestor class of TclObject, NsObject class is the superclass of
all basic network component objects that handle packets, which may compose compound
network objects such as nodes and links. The basic network components are further
divided into two subclasses, Connector and Classifier, based on the number of the
possible output data paths. The basic network objects that have only one output data path
are under the Connector class, and switching objects that have possible multiple output
data paths are under the Classifier class.
In NS, Unicast nodes are the default nodes. To create Multicast nodes the user
must explicitly notify in the input OTcl script, right after creating a scheduler object, that
all the nodes that will be created are multicast nodes. After specifying the node type, the
user can also select a specific routing protocol other than using a default one.
Unicast
- $ns rtproto type
- type: Static, Session, DV, cost, multi-path
Multicast
- $ns multicast (right after set $ns [new Scheduler])
- $ns mrtproto type
- type: CtrMcast, DM, ST, BST
LINK:
A link is another major compound object in NS. When a user creates a link using a
duplex-link member function of a Simulator object, two simplex links in both directions
are created as shown in Figure 8.
Figure 8. Link
When each inserted trace object (i.e. EnqT, DeqT, DrpT and RecvT) receives a
packet, it writes to the specified trace file without consuming any simulation time, and
passes the packet to the next network object. The trace format will be examined in the
General Analysis Example section.
Queue Monitor
Basically, tracing objects are designed to record packet arrival time at which they
are located. Although a user gets enough information from the trace, he or she might be
interested in what is going on inside a specific output queue. For example, a user
interested in RED queue behavior may want to measure the dynamics of average queue
size and current queue size of a specific RED queue (i.e. need for queue monitoring).
Queue monitoring can be achieved using queue monitor objects and snoop queue objects
as shown in Figure 10.
Figure 10. Monitoring Queue
When a packet arrives, a snoop queue object notifies the queue monitor object of
this event. The queue monitor using this information monitors the queue. A RED queue
monitoring example is shown in the RED Queue Monitor Example section. Note that
snoop queue objects can be used in parallel with tracing objects even though it is not
shown in the above figure.
Note that the above figure does not show the exact behavior of a FTP over TCP. It
only shows the detailed internals of simulation network setup and a packet flow.
PACKET:
A NS packet is composed of a stack of headers, and an optional data space (see
Figure 12). As briefly mentioned in the "Simple Simulation Example" section, a packet
header format is initialized when a Simulator object is created, where a stack of all
registered (or possibly useable) headers, such as the common header that is commonly
used by any objects as needed, IP header, TCP header, RTP header (UDP uses RTP
header) and trace header, is defined, and the offset of each header in the stack is recorded.
What this means is that whether or not a specific header is used, a stack composed of all
registered headers is created when a packet is allocated by an agent, and a network object
can access any header in the stack of a packet it processes using the corresponding offset
value.
Usually, a packet only has the header stack (and a data space pointer that is null).
Although a packet can carry actual data (from an application) by allocating a data space,
very few application and agent implementations support this. This is because it is
meaningless to carry data around in a non-real-time simulation. However, if you want to
implement an application that talks to another application cross the network, you might
want to use this feature with a little modification in the underlying agent implementation.
Another possible approach would be creating a new header for the application and
modifying the underlying agent to write data received from the application to the new
header. The second approach is shown as an example in a later section called "Add New
Application and Agent".
RESULT:
Thus the details about NS2(Network Simulator 2) has been studied.
Ex. No. STUDY OF OPNET
Date:
AIM:
To study about OPNET - Network Simulator
INTRODUCTION:
OPNET (Optimized Network Engineering Tools) is a commercial tool from MIL3
Inc. It is being developed for almost 15 years. As everyone should guess, no much
technical detail are available about the internals.
USE:
Network with several hundreds of nodes can be simulated, but it would take time
for the computation. OPNET is used by companies like Thomson-CSF or CNET which
use it to model ATM networks and validate various layers protocols, packet switched
radio networks. An example of use of OPNET is George Mason University (Quality of
Service IP Network Simulation).
THE PACKAGE
The software comprises several tools and is divided in several parts, OPNET
Modeler and OPNET Planner, the Model Library, and the Analysis tool. Features
included in this generic simulator are an event-driven scheduled simulation kernel,
integrated analysis tools for interpreting and synthesizing output data, graphical
specification of models and a hierarchical object-based modeling.
OPNET Modeler is intended for modeling, simulating and analyzing the
performance of large communications networks, computer systems and applications.
Common uses are assessing and feasibility of new designs, optimizing already developed
communication systems and predicting performance.
The modeling methodology of OPNET is organized in a hierarchical structure. At
the lowest level, Process models are structured as a finite state machine. State and
transitions are specified graphically using state-transition diagrams whereas conditions
that specify what happen within each state are programmed with a C-like language called
Proto-C. Those processes and built-in modules in OPNET (source and destination
modules, traffic generators, queues, ...) are then configured with menus and organized
into data flow diagrams that represent nodes using the graphical Node Editor. Using a
graphical Network Editor, nodes and links are selected to build up the topology of a
communication network.
The Analysis Tool provides a graphical environment to view and manipulate data
collected during simulation runs. Results can be analyzed for any network element.
OPNET Planner is an application that allows administrators to evaluate the
performance of communications networks and distributed systems, without programming
or compiling. Planner analyses behavior and performance by discrete-event simulations.
Models are built using a graphical interface. The user only chooses pre-defined models
(from the physical layer to the application) from the library and sets attributes. The user
cannot define new models, he should contact MIL3's modeling service.
The modeling libraries are included with OPNET Modeler and OPNET Planner
and contains protocols and analysis environments, among them ATM, TCP, IP, Frame
Relay, FDDI, Ethernet, link models such as point-to-point or bus, queueing service
disciplines such as First-in-First-Out (FIFO), Last-In-First-Out (LIFO), priority non-
preemptive queueing, shortest first job, round-robin or preempt and resume.
OPNET Modeler is the industry's leading environment for network modeling and
simulation, allowing you to design and study communication networks, devices,
protocols, and applications with unmatched flexibility and scalability. Modeler is used by
the world's largest network equipment manufacturers to accelerate the R&D of network
devices and technologies such as VoIP, TCP, OSPFv3, MPLS, IPv6, and more.
Networking technology has become too complex for traditional analytical
methods or "rules of thumb" to yield an accurate understanding of system behavior.
Since 1986, OPNET Technologies Inc., has been the leader in developing
predictive software solutions for networking professionals. OPNET software enables its
users to optimize the performance and maximize the availability of communications
networks and applications.
OPNET is the state-of-art network simulation tool for modeling, simulating and analysing
the performance of
i. Communication Networks, Distributed Systems
ii. Computer systems and Applications.
OPNET MODULES:
Modeler
Terrain Modeling Module (TMM)
High Level Architecture (HLA)
MODELER:
OPNET Modeler is intended for modeling, simulating and analysing the
performance of large communications networks, computer systems and applications.
Common uses are assessing and feasibility of new designs, optimizing already developed
communication systems and predicting performance.
The modeling methodology of OPNET is organized in a hierarchical structure. At
the lowest level, Process models are structured as a finite state machine. State and
transitions are specified graphically using state-transition diagrams whereas conditions
that specify what happen within each state are programmed with a C-like language called
Proto-C. Those processes, and built-in modules in OPNET (source and destination
modules, traffic generators, queues, ...) are then configured with menus and organized
into data flow diagrams that represent nodes using the graphical Node Editor. Using a
graphical Network Editor, nodes and links are selected to build up the topology of a
communication network.
TERRAIN MODELING MODULE (TMM)
Building on the capabilities of OPNET's Wireless Module, the Terrain Modeling
Module provides the next level of accuracy and control for wireless network design and
planning. This module allows you to model environmental effects on wireless network
communications anywhere.
Featuring an open-source Longley-Rice model, the Terrain Modeling Module is
ready to replicate any known atmospheric or topological conditions and their combined
impact on signal propagation. Create elevation maps, line-of-sight profiles, and signal-
power comparisons of mobile network models. Interfaces to read DTED and USGS DEM
terrain data are provided. Open and flexible, the Terrain Modeling Module is supported
by the standard Radio Transceiver Pipeline, which enables easy implementation of
custom propagation models
RESULT:
Thus the Network Simulator-OPNET has been studied.