Escolar Documentos
Profissional Documentos
Cultura Documentos
9
10
10
11
12
12
15
18
21
3
3
24
27
30
33
36
39
42
45
k/
e.t
ub
et
cs
Cumulative No.
Of periods
://
No. of
Periods
tp
ht
Expt.
No
No. of
Periods
Cumulative
No.
Of periods
49
53
57
60
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
http://csetube.tk/
1. Introduction to VI Editor
The VI editor is a screen-based editor used by many Unix users. The VI editor has powerful
features to aid programmers, but many beginning users avoid using VI because the different
features overwhelm them. This tutorial is written to help beginning users get accustomed to using
the VI editor, but also contains sections relevant to regular users of VI as well. Examples are
provided, and the best way to learn is to try these examples, and think of your own examples as
well... There's no better way than to experience things yourself.
1.1 Starting the VI Editor
The VI editor lets a user create new files or edit existing files. The command to start the VI editor
is vi, followed by the filename. For example to edit a file called temporary, you would type vi
temporary and then return. You can start VI without a filename, but when you want to save your
work, you will have to tell VI which filename to save it into later.
When you start VI for the first time, you will see a screen filled with tildes (A tilde looks like this:
~) on the left side of the screen. Any blank lines beyond the end of the file are shown this way. At
the bottom of your screen, the filename should be shown, if you specified an existing file, and the
size of the file will be shown as well, like this:
tp
://
cs
et
ub
e.t
k/
ht
Most commands are one character long, including those which use control characters. The
commands described in this section are those which are used most commonly the VI editor.
http://csetube.tk/
ub
e.t
k/
>
tp
ht
<
://
cs
et
^
.
*
$
[
The t and T commands search for a character on the current line only, but for t, the cursor moves
to the position before the character, and T searches the line backwards to the position after the
character.
These two sets of commands can be repeated using the ; or , command, where ; repeats the last
character search command in the same direction, while , repeats the command in the reverse
direction.
4. Recovering Your Work When Something Goes Wrong with Your Terminal
The VI editor edits a temporary copy of your file, and after the editing is complete, or when you
tell it to save, it puts the contents of the temporary copy into the original file. If something goes
wrong while you are editing your file, the VI editor will attempt to save whatever work you had in
progress, and store it for later recovery. (Note: If VI dies while you were working on any file, it
sends you an email message on how to recover it. The -r option stands for recovery. If you were
editing the file vital info, and you accidentally got logged out, then the -r option of the 'vi' editor
http://csetube.tk/
Function
or
or
or <Spacebar>
or
Cursor up.
or
Cursor down.
Cursor right.
gg
cs
et
ub
e.t
k/
ht
tp
://
Insert a blank line below the current line and then start insert
mode.
Insert a blank line above the current line and then start insert
mode.
:wq
:q
Quit.
:q!
dd
:j!
Undo.
Ctrl-R
Redo.
de
http://csetube.tk/
d$
d^
dd
2dd
Ctrl-G
5G
/search-string
:,$s/\<search-string
\>/replace-string /gc
:5,20w
filename
:5,$w!
filename
:r
filename
k/
cs
://
filename
ht
:w
tp
:%s/search-string /replacestring /g
et
:8,22s/search-string /replacestring /g
e.t
ub
?search-string
highlighted text.
:help
Reference manual (open new window with help screen inside-probably the most important command here!).
:new
:split
filename
:q
:qa
Ctrl-W j
http://csetube.tk/
Ctrl-W -
Ctrl-W +
e.t
k/
A socket type is uniquely determined by a <domain, type, protocol> triple. In order for a remote
socket to be reached, it must be possible to assign a name to it. The form that this name assumes is
determined by the communication domain or address family to which the socket belongs. There is
also an abstract type or style of communication associated with each socket. This gives the
semantics of communication for that socket. Finally, there is a specific protocol that is used with
the socket.
et
ub
A socket can be created with the socket()system call by specifying the desired address family,
socket type, and protocol.
tp
://
cs
ht
This call returns a small positive integer called a socket descriptor that can be used as a parameter
to reference the socket in subsequent system calls. Socket descriptors are similar to file descriptors
returned by the open() system call. Each open() or socket() call will return the smallest
unused integer. Thus a given number denotes either an open file, a socket, or neither (but never
both). Socket and file descriptors may be used interchangeably in many system calls. For example,
the close() system call is used to destroy sockets.
6.2 Domains
The communication domain or address family to which a socket belongs specifies a certain address
format. All later operations on a socket will interpret the supplied address according to this
specified format. The various address formats are defined as manifest constants in the file
<sys/socket.h>. Examples are AF_UNIX (UNIX path names), AF_INET (DARPA Internet
addresses), and AF_OSI (as specified by the international standards for Open Systems
Interconnection). AF_UNIX and AF_INET are the most important address families. The general
form of an address is represented by the sockaddr structure defined in <sys/socket.h>.
struct sockaddr {
short sa_family; /* address family */
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
Internet host addresses are specified in four bytes (32 bits). They are typically represented by a
standard `.' notation, a.b.c.d. The bytes of the address are represented by decimal integers,
separated by periods, and ordered from high order to low order. This ordering is called network
order and is the order in which addresses are transmitted over the network. For example, the
Internet address for the host garfield.cs.wisc.edu is 128.105.1.3 which corresponds to the unsigned
integer 80690103 in hex, or 2154365187 in decimal. Some hosts (such as the VAX), however,
have a host order for these integer values that reverses the order of the bytes. When a word is
transmitted from such a host (or when a C program treats a word as a sequence of bytes), the loworder byte is transmitted first (has the lowest address). Thus, it is necessary to reverse the bytes of
an address, stored in an integer, before transmitting it. The system routines htonl() and ntohl()
are provided to convert long (32-bit) integers from host to network order and vice versa. Similarly,
htos() and ntohs() swap the bytes of short (16-bit) integers, such as port numbers. System calls
that return or demand Internet addresses and port numbers (such as gethostbyname() or bind(),
which is described above), deal entirely in network order, so you normally don't have to worry
about all this. However, if you want to print out one of these values or read it in, you will have to
convert from/to host order.
An Internet host address can be decomposed into two parts, a network number and a local address.
There are three formats for Internet addresses (see inet(3N)), each of which partitions the 32 bits
differently. "Class A" addresses have a one-byte network number (the high order byte), and a 3byte host number. "Class B" addresses have two bytes each of network and host number, and "class
C" networks have three bytes of network number and one byte of host number. (Thus a class C
network can have at most 256 hosts). The high-order bits of an address determine its class:
Addresses starting with a zero are class A addresses, addresses starting with 10 are class B, and
addresses starting with 110 are class C. Thus there can be at most 128 class A networks and at
most 214 = 16,384 class B networks.
The system calls gethostbyaddr() and gethostbyname() can be used to look up the host address
(see gethostent(3N) and host(5)). Each of these calls returns a pointer to the structure hostent
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
Stream sockets must establish a connection before data can be transferred. A stream socket is either
"active" or "passive". A socket is initially active and only becomes passive after a listen call. Only
active sockets can be mentioned in a connect call and only passive sockets can be mentioned in
accept. These connection establishment calls are intended for use with stream sockets, but
datagram sockets can call connect to permanently fix the destination for future send calls.
10.1 Active End
An active socket establishes a connection to a named passive socket by using the connect()
system call.
status = connect(sock, name, namelen)
int sock; /* socket descriptor */
struct sockaddr *name;
int namelen;
The name parameter is the address of the remote socket interpreted according to the
communication domain in which the socket exists. If the domain is AF_UNIX, this should be a
sockaddr_un structure; if the domain is AF_INET, it should be a sockaddr_in structure.
10.2 Passive End
http://csetube.tk/
cs
et
ub
e.t
k/
Accept takes the first pending connection request off the queue and returns a socket descriptor for a
new, connected socket. This socket has the same properties as the old socket. The address of the
socket at the active end is returned in name. Namelen is a value/result parameter that should be
initialized to the size of the address structure being passed; upon return it will be set to the actual
length of the address returned. The old socket remains unaffected and can be used to accept more
connections. If there are no pending connection requests, accept blocks. If necessary, a select can
be done first to see if there are any connection requests. A socket with pending connections will
show up as being ready for reading.
ht
tp
://
http://csetube.tk/
cs
et
ub
e.t
k/
ht
tp
://
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
This will prevent any more reads and writes to the socket. Anyone attempting to read or write the
socket on the remote end will receive an error.
To have more control over how the socket closes, use the shutdown() function. It allows you to cut
off communication in a certain direction, or both ways
int shutdown(int sockfd, int how);
sockfd is the socket file descriptor you want to shutdown, and how is one of the following:
0 -- Further receives are disallowed
1 -- Further sends are disallowed
2 -- Further sends and receives are disallowed (like close())
shutdown() returns 0 on success, and -1 on error (with errno set accordingly.)
11. Getting the destination name
getpeername() : The function getpeername() gives the other end of a connected stream socket.
int getpeername(int sockfd, struct sockaddr *addr, int *addrlen);
sockfd is the descriptor of the connected stream socket, addr is a pointer to a struct sockaddr (or a
struct sockaddr_in) that will hold the information about the other side of the connection, and
addrlen is a pointer to an int, that should be initialized to sizeof(struct sockaddr).
The function returns -1 on error and sets errno accordingly.
12. Getting the source name
gethostname()
It returns the name of the computer that your program is running on. The name can then be used
by gethostbyname(), below, to determine the IP address of your local machine.
int gethostname(char *hostname, size_t size);
hostname is a pointer to an array of chars that will contain the hostname upon the function's return,
and size is the length in bytes of the hostname array.
The function returns 0 on successful completion, and -1 on error, setting errno as usual.
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
http://csetube.tk/
tp
ht
connect( );
://
cs
et
ub
*bind( );
e.t
k/
Application level
socket( );
http://csetube.tk/
*listen( );
k/
*accept( );
Network PC level
This will set up a data structure for the
operating system to use, to read and write,
and control the socket
Bind is used to realte a local port number to
a socket, therefore if you wanted to create a
server that ran on a specific port, such as
telnet, FTP, and HTTP, you will need to
use bind in your sever application.
The call to listen( ) is only needed in TCP
applications, this will allow you to specify
how many clients can connect to any given
TCP port at one time.
The call to accept( ) again , is only needed
in TCP applications, this will allow you to
preform the server side of the three way
handshake when a client connects. If
accept is successfull it will return a new
socket to you for reading and writting.
UDP can use send( ), recv( ), sendto( ),
recvfrom( ), read( ), and write( ) for passing
data. If you have used bind to bind a
ipaddress and port, you will most likely
want to just use recv for reading, and send
for sending. If you have not used bind on
the UDP socket it may be nessary to use
sendto, and recv, or recvfrom.
These functions will close the socket and
deallocate any resources from the OS.
ht
tp
://
cs
et
ub
e.t
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
15.2 Starting ns
You start ns with the command 'ns <tclscript>' (assuming that you are in the directory with the ns
executable, or that your path points to that directory), where '<tclscript>' is the name of a Tcl script
file which defines the simulation scenario (i.e. the topology and the events). You could also just
start ns without any arguments and enter the Tcl commands in the Tcl shell, but that is definitely
less comfortable. For information on how to write your own Tcl scripts for ns.Everything else
depends on the Tcl script. The script might create some output on stdout, it might write a trace file
or it might start nam to visualize the simulation. Or all of the above. These possibilities will all be
discussed in later sections.
15.3 Starting nam
You can either start nam with the command 'nam <nam-file>' where '<nam-file>' is the name of a
nam trace file that was generated by ns, or you can execute it directly out of the Tcl simulation
script for the simulation which you want to visualize. Below you can see a screenshot of a nam
window where the most important functions are being explained.
http://csetube.tk/
ub
e.t
k/
ht
tp
://
cs
et
http://csetube.tk/
e.t
cs
et
ub
k/
ht
tp
://
http://csetube.tk/
e.t
ub
k/
://
cs
et
ht
tp
http://csetube.tk/
et
ub
e.t
k/
ht
tp
://
cs
Now you start some experiments with nam and the Tcl script. You can click on any packet in the
nam window to monitor it, and you can also click directly on the link to get some graphs with
statistics.Try to change the 'packetsize_' and 'interval_' parameters in the Tcl script to see what
happens.
#Create a simulator object
set ns [new Simulator]
#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the trace file
close $nf
#Execute nam on the trace file
exec nam out.nam &
exit 0
}
#Create two nodes
set n0 [$ns node]
set n1 [$ns node]
#Create a duplex link between the nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
#Create a UDP agent and attach it to node n0
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
http://csetube.tk/
ub
e.t
k/
tp
://
cs
et
ht
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
This code allows you to set different colors for each flow id.
Now you can start the script again and one flow should be blue, while the other one is red. Watch
the link from node n2 to n3 for a while, and you will notice that after some time the distribution
between blue and red packets isn't too fair anymore (at least that's the way it is on my system). In
the next section I'll show you how you can look inside this link's queue to find out what is going on
there.
Monitoring a queue
You only have to add the following line to your code to monitor the queue for the link from n2 to
n3.
$ns duplex-link-op $n2 $n3 queuePos 0.5
Start ns again and you will see a picture similar to the one below after a few moments.
http://csetube.tk/
k/
You can see the packets in the queue now, and after a while you can even see how the packets are
being dropped, though (at least on my system, I guess it might be different in later or earlier
releases) only blue packets are being dropped. But you can't really expect too much 'fairness' from
a simple Drop Tail queue. So let's try to improve the queuing by using a SFQ (stochastic fair
queuing) queue for the link from n2 to n3. Change the link definition for the link between n2 and
n3 to the following line.
$ns duplex-link $n3 $n2 1Mb 10ms SFQ
The queuing should be 'fair' now. The same amount of blue and red packets should be dropped.
Appendix A
tp
://
cs
et
ht
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
*/
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/un.h>
#include <stdarg.h>
Usefull Defines
ub
e.t
Header Files
When programming sockets you will need to #include the following header files:
http://csetube.tk/
k/
Appendix B
ht
tp
://
cs
et
ub
e.t
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
}
}
http://csetube.tk/
e.t
k/
myaddr.sin_family=AF_INET;
/* Structure variable definition */
myaddr.sin_port=htons(PORTNO);
myaddr.sin_addr.s_addr=INADDR_ANY;
memset(&(myaddr.sin_zero),'\0',8); /* fills with constant byte to remaining space */
ht
tp
://
cs
et
ub
http://csetube.tk/
ub
e.t
k/
int fd;
ht
tp
://
cs
et
int sin_size;
int x;
if ((fd=socket(AF_INET, SOCK_STREAM, 0)) == -1 ){ /* calls socket() */
printf("socket() error\n");
exit(-1);
}
server.sin_family = AF_INET;
server.sin_port = htons(PORT);
/* Remember htons() from "Conversions" section? =) */
server.sin_addr.s_addr = INADDR_ANY; /* INADDR_ANY puts your IP address automatically */
bzero(&(server.sin_zero),8);
/* zero the rest of the structure */
if(bind(fd,(struct sockaddr*)&server,sizeof(struct sockaddr))==-1) /* calls bind() */
{
printf("bind() error\n");
exit(-1);
}
x=listen(fd,BACKLOG) ;
/* calls listen() */
if(x==-1)
{
printf("listen() error\n");
exit(-1);
}
else
{
printf(Server is in listening mode \n );
http://csetube.tk/
tp
://
cs
et
ub
e.t
k/
/* close fd */
ht
}
close(fd);
http://csetube.tk/
ub
e.t
k/
ht
tp
://
cs
et
int sin_size;
if ((fd=socket(AF_INET, SOCK_STREAM, 0)) == -1 ) /* calls socket() */
{
printf("socket() error\n");
exit(-1);
}
server.sin_family = AF_INET;
server.sin_port = htons(PORT);
/* Remember htons() from "Conversions" section */
server.sin_addr.s_addr = INADDR_ANY; /* INADDR_ANY puts your IP address automatically */
bzero(&(server.sin_zero),8);
/* zero the rest of the structure */
if(bind(fd,(struct sockaddr*)&server,sizeof(struct sockaddr))==-1){ /* calls bind() */
printf("bind() error\n");
exit(-1);
}
{
if(listen(fd,BACKLOG) == -1)
/* calls listen() */
printf("listen() error\n");
exit(-1);
}
printf("server is in accept mode \n ");
http://csetube.tk/
k/
e.t
ub
et
cs
://
tp
ht
}
}
http://csetube.tk/
main()
{
int fd, fd2;
/* file descriptors */
/* server's address information */
/* client's address information */
k/
ub
e.t
int sin_size;
ht
tp
://
cs
et
if(listen(fd,BACKLOG) == -1)
/* calls listen() */
printf("listen() error\n");
exit(-1);
while(1){
http://csetube.tk/
://
cs
et
ub
e.t
k/
tp
/* close fd2 */
ht
close(fd2);
http://csetube.tk/
/* files descriptors */
/* buf will store received text */
/* structure that will get information about remote host */
/* server's address information */
k/
cs
et
ub
e.t
if (argc !=2) {
ht
tp
://
}
if ((he=gethostbyname(argv[1]))==NULL){
/* calls gethostbyname() */
printf("gethostbyname() error\n");
exit(-1);
}
if ((fd=socket(AF_INET, SOCK_STREAM, 0))==-1){ /* calls socket() */
printf("socket() error\n");
exit(-1);
}
server.sin_family = AF_INET;
server.sin_port = htons(PORT);
/* htons() is needed again */
server.sin_addr = *((struct in_addr *)he->h_addr); /*he->h_addr passes "*he"'s info to
"h_addr" */
bzero(&(server.sin_zero),8);
if(connect(fd, (struct sockaddr *)&server,sizeof(struct sockaddr))==-1)
printf("connect() error\n");
exit(-1);
}
if ((numbytes=recv(fd,buf,MAXDATASIZE,0)) == -1)
/* calls recv() */
printf("recv() error\n");
exit(-1);
http://csetube.tk/
tp
://
cs
et
ub
e.t
k/
ht
buf[numbytes]='\0';
printf("Server Message: %s\n",buf); /* it prints server's welcome message =) */
close(fd); /* close fd =) */
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
{
fprintf(stderr , "usage : getip address \n ");
exit(1);
}
if((h=gethostbyname(argv[1])) == NULL) /* Get the Local host name */
{
herror("gethostbyname ");
exit(1);
}
printf(" Host name : %s \n ",h->h_name);
printf("IP address : %s \n ", inet_ntoa(*((struct in_addr *)h->h_addr)));
return 0;
}
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#define MYPORT 4950
// the port users will be connecting to
int main(int argc, char *argv[])
{
int sockfd;
struct sockaddr_in their_addr;
// connectors address information
struct hostent *he;
int numbytes;
if (argc != 3) {
fprintf(stderr,"usage: talker hostname message\n");
exit(1);
}
if ((he=gethostbyname(argv[1])) == NULL) {
// get the host info
perror("gethostbyname");
exit(1);
}
if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
perror("socket");
exit(1);
}
their_addr.sin_family = AF_INET;
// host byte order
their_addr.sin_port = htons(MYPORT);
// short, network byte order
their_addr.sin_addr = *((struct in_addr *)he->h_addr);
memset(&(their_addr.sin_zero), \0, 8);
// zero the rest of the struct
if ((numbytes=sendto(sockfd, argv[2], strlen(argv[2]), 0,
(struct sockaddr *)&their_addr, sizeof(struct sockaddr))) == -1) {
perror("sendto");
exit(1);
}
printf("sent %d bytes to %s\n", numbytes,
inet_ntoa(their_addr.sin_addr));
close(sockfd);
return 0;
}
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
http://csetube.tk/
SIMULATION OF ARP/RARP
DATE:
AIM:
EX.NO: 1
ALGORITHM:
1. Start the program with required header files.
2. To define file descriptor with characters, variables and character pointer.
3. The MAC address and IP address are obtained from the user.
k/
e.t
MAC
et
ub
6. ARP is used to Map the IP address and MAC Address and its display the
address on the screen.
://
cs
ht
screen.
tp
8. RARP used to Map the MAC address and IP address and its display the IP address on the
9. Stop.
http://csetube.tk/
ub
e.t
k/
Client File:
The APR table is
A1.B2.C3.D4.E5.F6
A2.B3.C4.D5.E6.F7
A3.B4.C5.D6.E7.F8
ht
tp
://
cs
et
1.ARP
2.RARP
3.EXIT
Result:
http://csetube.tk/
BITSTUFFING
DATE:
AIM:
EX.NO: 2
ALGORITHM:
1. Start the program with required header files.
2. Get the input string from the user and find out the length of the string.
3. Covert the given input string into ASCII character.
4. Calculate the binary equivalent of each character.
5. Check the number of ones present in the binary value.
e.t
k/
6. If there are five consecutive ones in the binary value then insert the parity bit in sixth
ub
position.
et
ht
tp
://
cs
8. Stop.
Input:
Enter the i/p string:
10101111110101111110
Output:
The bit stuffed string is 1010111110101011111010
Result:
http://csetube.tk/
EX.NO: 3
ALGORITHM:
1. CRC is one of the powerful redundancies checking technique.
2. Get the input form the user.
3. Calculate the key value. Key k= number of bits present in the input 1.
4. The key using binary division technique divides the input string.
5. The reminder is the required CRC it replaces the 0s in the input string then transmits your
e.t
k/
input.
ub
6. At the receiving end the key using binary division divides the received message.
://
ht
tp
error message.
cs
et
http://csetube.tk/
ht
tp
://
cs
et
ub
e.t
k/
Result:
http://csetube.tk/
EX.NO: 4
AIM:
To write a c program to develop an application for transferring files over RS232
ALGORITHM:
tp
ht
Input:
://
cs
et
ub
e.t
k/
Result:
http://csetube.tk/
EX.NO: 5
AIM:
To write a C program to perform sliding window.
ALGORITHM:
Start the program.
Get the frame size from the user
To create the frame based on the user request.
To send frames to server from the client side.
If your frames reach the server it will send ACK signal to client otherwise it will send NACK
signal to client.
6. Stop the program
et
ub
e.t
k/
1.
2.
3.
4.
5.
tp
ht
://
cs
Input:
Output:
ACK signal from server.
NACK signal from server.
Result:
Thus the program was executed successfully.
http://csetube.tk/
AIM:
EX.NO: 6
ALGORITHM:
tp
ht
://
cs
et
ub
e.t
k/
Server:
[admin@root cse03]$./.a.out 16257
Type the message to client:
Hi how are you
Client: hello how are you.
Fine
Client:
[admin@root cse03]$. /.a.out 192.168.3.33 16257
Enter the message to server
Server: Hi how are you
Hello how are you.
Server: Fine
Result:
http://csetube.tk/
connect
AIM:
EX.NO: 7
To write a C program to develop a DNS client server to resolve the given hostname.
ALGORITHM:
ub
e.t
k/
Create a new file. Enter the domain name and address in that file.
To establish the connection between client and server.
Compile and execute the program.
Enter the domain name as input.
The IP address corresponding to the domain name is display on the screen
Enter the IP address on the screen.
The domain name corresponding to the IP address is display on the screen.
Stop the program.
Output:
Result:
ht
Input:
tp
://
cs
et
1.
2.
3.
4.
5.
6.
7.
8.
http://csetube.tk/
HTTP SERVER
DATE:
EX.NO: 8
AIM:
To write a c program to download the file from HTTP server.
ALGORITHM:
tp
ht
://
cs
et
ub
e.t
k/
<html>
<title>sample</title>
<body>
<h1>welcome to my home page</h1>
</body>
</html>
Result:
http://csetube.tk/
NETWORK SIMULATOR
DATE:
EX.NO: 9
AIM:
To write a program to perform network simulator using ping.
ALGORITHM:
e.t
k/
ht
tp
://
cs
et
ub
1.
2.
3.
4.
5.
6.
7.
Result:
http://csetube.tk/