Sockets Tutorial This is a simple tutorial on using sockets for interprocess communication.

Size: px
Start display at page:

Download "Sockets Tutorial This is a simple tutorial on using sockets for interprocess communication."

Transcription

1 This site uses cookies for advertising. If you continue to use the site, you accept the use of cookies. more info Sockets Tutorial This is a simple tutorial on using sockets for interprocess communication. The client server model Most interprocess communication uses the client server model. These terms refer to the two processes which will be communicating with each other. One of the two processes, the client, connects to the other process, the server, typically to make a request for information. A good analogy is a person who makes a phone call to another person. Notice that the client needs to know of the existence of and the address of the server, but the server does not need to know the address of (or even the existence of) the client prior to the connection being established. Notice also that once a connection is established, both sides can send and receive information. The system calls for establishing a connection are somewhat different for the client and the server, but both involve the basic construct of a socket. A socket is one end of an interprocess communication channel. The two processes each establish their own socket. The steps involved in establishing a socket on the client side are as follows: Create a socket with the socket() system call Connect the socket to the address of the server using the connect() system call Send and receive data. There are a number of ways to do this, but the simplest is to use the read() and write() system calls. The steps involved in establishing a socket on the server side are as follows: Create a socket with the socket() system call Bind the socket to an address using the bind() system call. For a server socket on the Internet, an address consists of a port number on the host machine. Listen for connections with the listen() system call Accept a connection with the accept() system call. This call typically blocks until a client connects with the server. Send and receive data Socket Types When a socket is created, the program has to specify the address domain and the socket type. Two processes can communicate with each other only if their sockets are of the same type and in the same domain. There are two widely used address domains, the unix domain, in which two processes which share a common file system communicate, and the Internet domain, in which two processes running on any two hosts on the Internet communicate. Each of these has its own address format. The address of a socket in the Unix domain is a character string which is basically an entry in the file system. page 1 of 13

2 The address of a socket in the Internet domain consists of the Internet address of the host machine (every computer on the Internet has a unique 32 bit address, often referred to as its IP address). In addition, each socket needs a port number on that host. Port numbers are 16 bit unsigned integers. The lower numbers are reserved in Unix for standard services. For example, the port number for the FTP server is 21. It is important that standard services be at the same port on all computers so that clients will know their addresses. However, port numbers above 2000 are generally available. There are two widely used socket types, stream sockets, and datagram sockets. Stream sockets treat communications as a continuous stream of characters, while datagram sockets have to read entire messages at once. Each uses its own communciations protocol. Stream sockets use TCP (Transmission Control Protocol), which is a reliable, stream oriented protocol, and datagram sockets use UDP (Unix Datagram Protocol), which is unreliable and message oriented. The examples in this tutorial will use sockets in the Internet domain using the TCP protocol. Sample code C code for a very simple client and server are provided for you. These communicate using stream sockets in the Internet domain. The code is described in detail below. However, before you read the descriptions and look at the code, you should compile and run the two programs to see what they do. server.c client.c Download these into files called server.c and client.c and compile them separately into two executables called server and client. They probably won't require any special compiling flags, but on some solaris systems you may need to link to the socket library by appending -lsocket to your compile command. Ideally, you should run the client and the server on separate hosts on the Internet. Start the server first. Suppose the server is running on a machine called cheerios. When you run the server, you need to pass the port number in as an argument. You can choose any number between 2000 and If this port is already in use on that machine, the server will tell you this and exit. If this happens, just choose another port and try again. If the port is available, the server will block until it receives a connection from the client. Don't be alarmed if the server doesn't do anything; It's not supposed to do anything until a connection is made. Here is a typical command line: server To run the client you need to pass in two arguments, the name of the host on which the server is running and the port number on which the server is listening for connections. Here is the command line to connect to the server described above: client cheerios page 2 of 13

3 The client will prompt you to enter a message. If everything works correctly, the server will display your message on stdout, send an acknowledgement message to the client and terminate. The client will print the acknowledgement message from the server and then terminate. You can simulate this on a single machine by running the server in one window and the client in another. In this case, you can use the keyword localhost as the first argument to the client. The server code uses a number of ugly programming constructs, and so we will go through it line by line. #include >stdio.h> This header file contains declarations used in most input and output and is typically included in all C programs. #include >sys/types.h> This header file contains definitions of a number of data types used in system calls. These types are used in the next two include files. #include >sys/socket.h> The header file socket.h includes a number of definitions of structures needed for sockets. #include >netinet/in.h> The header file in.h contains constants and structures needed for internet domain addresses. void error(char *msg) perror(msg); exit(1); This function is called when a system call fails. It displays a message about the error on stderr and then aborts the program. The perror man page gives more information. int main(int argc, char *argv[]) int sockfd, newsockfd, portno, clilen, n; sockfd and newsockfd are file descriptors, i.e. array subscripts into the file descriptor table. These two variables store the values returned by the socket system call and the accept system call. portno stores the port number on which the server accepts connections. clilen stores the size of the address of the client. This is needed for the accept system call. n is the return value for the read() and write() calls; i.e. it contains the number of characters read or written. char buffer[256]; The server reads characters from the socket connection into this buffer. page 3 of 13

4 struct sockaddr_in serv_addr, cli_addr; A sockaddr_in is a structure containing an internet address. This structure is defined in netinet/in.h. Here is the definition: struct sockaddr_in short sin_family; /* must be AF_INET */ u_short sin_port; struct in_addr sin_addr; char sin_zero[8]; /* Not used, must be zero */ ; An in_addr structure, defined in the same header file, contains only one field, a unsigned long called s_addr. The variable serv_addr will contain the address of the server, and cli_addr will contain the address of the client which connects to the server. if (argc < 2) fprintf(stderr,"error, no port provided "); exit(1); The user needs to pass in the port number on which the server will accept connections as an argument. This code displays an error message if the user fails to do this. sockfd = socket(af_inet, SOCK_STREAM, 0); if (sockfd < 0) error("error opening socket"); The socket() system call creates a new socket. It takes three arguments. The first is the address domain of the socket. Recall that there are two possible address domains, the unix domain for two processes which share a common file system, and the Internet domain for any two hosts on the Internet. The symbol constant AF_UNIX is used for the former, and AF_INET for the latter (there are actually many other options which can be used here for specialized purposes). The second argument is the type of socket. Recall that there are two choices here, a stream socket in which characters are read in a continuous stream as if from a file or pipe, and a datagram socket, in which messages are read in chunks. The two symbolic constants are SOCK_STREAM and SOCK_DGRAM. The third argument is the protocol. If this argument is zero (and it always should be except for unusual circumstances), the operating system will choose the most appropriate protocol. It will choose TCP for stream sockets and UDP for datagram sockets. The socket system call returns an entry into the file descriptor table (i.e. a small integer). This value is used for all subsequent references to this socket. If the socket call fails, it returns -1. page 4 of 13

5 In this case the program displays and error message and exits. However, this system call is unlikely to fail. This is a simplified description of the socket call; there are numerous other choices for domains and types, but these are the most common. The socket() man page has more information. bzero((char *) &serv_addr, sizeof(serv_addr)); The function bzero() sets all values in a buffer to zero. It takes two arguments, the first is a pointer to the buffer and the second is the size of the buffer. Thus, this line initializes serv_addr to zeros portno = atoi(argv[1]); The port number on which the server will listen for connections is passed in as an argument, and this statement uses the atoi() function to convert this from a string of digits to an integer. serv_addr.sin_family = AF_INET; The variable serv_addr is a structure of type struct sockaddr_in. This structure has four fields. The first field is short sin_family, which contains a code for the address family. It should always be set to the symbolic constant AF_INET. serv_addr.sin_port = htons(portno); The second field of serv_addr is unsigned short sin_port, which contain the port number. However, instead of simply copying the port number to this field, it is necessary to convert this to network byte order using the function htons() which converts a port number in host byte order to a port number in network byte order. serv_addr.sin_addr.s_addr = INADDR_ANY; The third field of sockaddr_in is a structure of type struct in_addr which contains only a single field unsigned long s_addr. This field contains the IP address of the host. For server code, this will always be the IP address of the machine on which the server is running, and there is a symbolic constant INADDR_ANY which gets this address. if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) error("error on binding"); The bind() system call binds a socket to an address, in this case the address of the current host and port number on which the server will run. It takes three arguments, the socket file descriptor, the address to which is bound, and the size of the address to which it is bound. The second argument is a pointer to a structure of type sockaddr, but what is passed in is a structure of type sockaddr_in, and so this must be cast to the correct type. This can fail for a number of reasons, the most obvious being that this socket is already in use on this machine. The bind() manual has more information. listen(sockfd,5); page 5 of 13

6 The listen system call allows the process to listen on the socket for connections. The first argument is the socket file descriptor, and the second is the size of the backlog queue, i.e., the number of connections that can be waiting while the process is handling a particular connection. This should be set to 5, the maximum size permitted by most systems. If the first argument is a valid socket, this call cannot fail, and so the code doesn't check for errors. The listen() man page has more information. clilen = sizeof(cli_addr); newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen); if (newsockfd < 0) error("error on accept"); The accept() system call causes the process to block until a client connects to the server. Thus, it wakes up the process when a connection from a client has been successfully established. It returns a new file descriptor, and all communication on this connection should be done using the new file descriptor. The second argument is a reference pointer to the address of the client on the other end of the connection, and the third argument is the size of this structure. The accept() man page has more information. bzero(buffer,256); n = read(newsockfd,buffer,255); if (n < 0) error("error reading from socket"); printf("here is the message: %s ",buffer); Note that we would only get to this point after a client has successfully connected to our server. This code initializes the buffer using the bzero() function, and then reads from the socket. Note that the read call uses the new file descriptor, the one returned by accept(), not the original file descriptor returned by socket(). Note also that the read() will block until there is something for it to read in the socket, i.e. after the client has executed a write(). It will read either the total number of characters in the socket or 255, whichever is less, and return the number of characters read. The read() man page has more information. n = write(newsockfd,"i got your message",18); if (n < 0) error("error writing to socket"); Once a connection has been established, both ends can both read and write to the connection. Naturally, everything written by the client will be read by the server, and everything written by the server will be read by the client. This code simply writes a short message to the client. The last argument of write is the size of the message. The write() man page has more information. return 0; This terminates main and thus the program. Since main was declared to be of type int as specified by the ascii standard, some compilers complain if it does not return anything. Client code page 6 of 13

7 As before, we will go through the program client.c line by line. #include >stdio.h> #include >sys/types.h> #include >sys/socket.h> #include >netinet/in.h> #include >netdb.h> The header files are the same as for the server with one addition. The file netdb.h defines the structure hostent, which will be used below. void error(char *msg) perror(msg); exit(0); int main(int argc, char *argv[]) int sockfd, portno, n; struct sockaddr_in serv_addr; struct hostent *server; The error() function is identical to that in the server, as are the variables sockfd, portno, and n. The variable serv_addr will contain the address of the server to which we want to connect. It is of type struct sockaddr_in. The variable server is a pointer to a structure of type hostent. This structure is defined in the header file netdb.h as follows: struct hostent char *h_name; /* official name of host */ char **h_aliases; /* alias list */ int h_addrtype; /* host address type */ int h_length; /* length of address */ char **h_addr_list; /* list of addresses from name server */ #define h_addr h_addr_list[0] /* address, for backward compatiblity */ ; It defines a host computer on the Internet. The members of this structure are: h_name Official name of the host. h_aliases A zero terminated array of alternate names for the host. h_addrtype The type of address being returned; currently always AF_INET. h_length The length, in bytes, of the address. h_addr_list A pointer to a list of network addresses for the named host. Host addresses are returned in network byte order. Note that h_addr is an alias for the first address in the array of network addresses. char buffer[256]; if (argc < 3) page 7 of 13

8 fprintf(stderr,"usage %s hostname port ", argv[0]); exit(0); portno = atoi(argv[2]); sockfd = socket(af_inet, SOCK_STREAM, 0); if (sockfd < 0) error("error opening socket"); All of this code is the same as that in the server. server = gethostbyname(argv[1]); if (server == NULL) fprintf(stderr,"error, no such host "); exit(0); The variable argv[1] contains the name of a host on the Internet, e.g. cs.rpi.edu. The function: struct hostent *gethostbyname(char *name) Takes such a name as an argument and returns a pointer to a hostent containing information about that host. The field char *h_addr contains the IP address. If this structure is NULL, the system could not locate a host with this name. In the old days, this function worked by searching a system file called /etc/hosts but with the explosive growth of the Internet, it became impossible for system administrators to keep this file current. Thus, the mechanism by which this function works is complex, often involves querying large databases all around the country. The gethostbyname() man page has more information. bzero((char *) &serv_addr, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr, server->h_length); serv_addr.sin_port = htons(portno); This code sets the fields in serv_addr. Much of it is the same as in the server. However, because the field server->h_addr is a character string, we use the function: void bcopy(char *s1, char *s2, int length) which copies length bytes from s1 to s if (connect(sockfd,&serv_addr,sizeof(serv_addr)) < 0) error("error connecting"); page 8 of 13

9 The connect function is called by the client to establish a connection to the server. It takes three arguments, the socket file descriptor, the address of the host to which it wants to connect (including the port number), and the size of this address. This function returns 0 on success and -1 if it fails. The connect() man page has more information. Notice that the client needs to know the port number of the server, but it does not need to know its own port number. This is typically assigned by the system when connect is called. printf("please enter the message: "); bzero(buffer,256); fgets(buffer,255,stdin); n = write(sockfd,buffer,strlen(buffer)); if (n < 0) error("error writing to socket"); bzero(buffer,256); n = read(sockfd,buffer,255); if (n < 0) error("error reading from socket"); printf("%s ",buffer); return 0; The remaining code should be fairly clear. It prompts the user to enter a message, uses fgets to read the message from stdin, writes the message to the socket, reads the reply from the socket, and displays this reply on the screen. Enhancements to the server code The sample server code above has the limitation that it only handles one connection, and then dies. A "real world" server should run indefinitely and should have the capability of handling a number of simultaneous connections, each in its own process. This is typically done by forking off a new process to handle each new connection. The following code has a dummy function called dostuff(int sockfd). This function will handle the connection after it has been established and provide whatever services the client requests. As we saw above, once a connection is established, both ends can use read and write to send information to the other end, and the details of the information passed back and forth do not concern us here. To write a "real world" server, you would make essentially no changes to the main() function, and all of the code which provided the service would be in dostuff(). To allow the server to handle multiple simultaneous connections, we make the following changes to the code: Put the accept statement and the following code in an infinite loop. After a connection is established, call fork()#### to create a new process. The child process will close sockfd#### and call #dostuff#####, passing the new socket file descriptor as an argument. When the two processes have completed their conversation, as indicated by dostuff()#### returning, this process simply exits. The parent process closes newsockfd####. Because all of this code is in an infinite loop, it will return to the accept statement to wait for the next connection. page 9 of 13

10 Here is the code. while (1) newsockfd = accept(sockfd, if (newsockfd < 0) error("error on accept"); pid = fork(); if (pid < 0) error("error on fork"); if (pid == 0) close(sockfd); dostuff(newsockfd); exit(0); else close(newsockfd); /* end of while */ (struct sockaddr *) &cli_addr, &clilen); Click here for a complete server program which includes this change. This will run with the program client.c. The zombie problem The above code has a problem; if the parent runs for a long time and accepts many connections, each of these connections will create a zombie when the connection is terminated. A zombie is a process which has terminated but but cannot be permitted to fully die because at some point in the future, the parent of the process might execute a wait and would want information about the death of the child. Zombies clog up the process table in the kernel, and so they should be prevented. Unfortunately, the code which prevents zombies is not consistent across different architectures. When a child dies, it sends a SIGCHLD signal to its parent. On systems such as AIX, the following code in main() is all that is needed. signal(sigchld,sig_ign); This says to ignore the SIGCHLD signal. However, on systems running SunOS, you have to use the following code: void *SigCatcher(int n) wait3(null,wnohang,null);... int main()... signal(sigchld,sigcatcher);... The function SigCatcher() will be called whenever the parent receives a SIGCHLD signal (i.e. whenever a child dies). This will in turn call wait3 which will receive the signal. The WNOHANG flag is set, which causes this to be a non-blocking wait (one of my favorite oxymorons). page 10 of 13

11 Alternative types of sockets This example showed a stream socket in the Internet domain. This is the most common type of connection. A second type of connection is a datagram socket. You might want to use a datagram socket in cases where there is only one message being sent from the client to the server, and only one message being sent back. There are several differences between a datagram socket and a stream socket. Datagrams are unreliable, which means that if a packet of information gets lost somewhere in the Internet, the sender is not told (and of course the receiver does not know about the existence of the message). In contrast, with a stream socket, the underlying TCP protocol will detect that a message was lost because it was not acknowledged, and it will be retransmitted without the process at either end knowing about this. Message boundaries are preserved in datagram sockets. If the sender sends a datagram of 100 bytes, the receiver must read all 100 bytes at once. This can be contrasted with a stream socket, where if the sender wrote a 100 byte message, the receiver could read it in two chunks of 50 bytes or 100 chunks of one byte. The communication is done using special system calls sendto()#### and receivefrom()#### rather than the more generic read()#### and write()####. There is a lot less overhead associated with a datagram socket because connections do not need to be established and broken down, and packets do not need to be acknowledged. This is why datagram sockets are often used when the service to be provided is short, such as a time-of-day service. Click here for the server code using a datagram socket. Click here for the client code using a datagram socket. These two programs can be compiled and run in exactly the same way as the server and client using a stream socket. Most of the server code is similar to the stream socket code. Here are the differences. sock=socket(af_inet, SOCK_DGRAM, 0); Note that when the socket is created, the second argument is the symbolic constant SOCK_DGRAM instead of SOCK_STREAM. The protocol will be UDP, not TCP fromlen = sizeof(struct sockaddr_in); while (1) n = recvfrom(sock,buf,1024,0,(struct sockaddr *)&from,&fromlen); if (n < 0) error("recvfrom"); Servers using datagram sockets do not use the listen() or the accept() system calls. After a socket has been bound to an address, the program calls recvfrom() to read a message. This call will block until a message is received. The recvfrom() system call takes six arguments. The first three are the same as those for the read() call, the socket file descriptor, the buffer into which the message will be read, and the maximum number of bytes. The fourth argument is an integer argument for flags. This is ordinarily set to zero. The fifth argument is a pointer to a sockaddr_in structure. When the call returns, the values of this structure will have been filled in for the other end of the connection (the client). The size of this structure will be in the last argument, a pointer to an integer. This call returns the number of bytes in the message. (or -1 on an error condition). The recfrom() man page has more information. page 11 of 13

12 n = sendto(sock,"got your message ",17, 0,(struct sockaddr *) &from,fromlen); if (n < 0) error("sendto"); To send a datagram, the function sendto() is used. This also takes six arguments. The first three are the same as for a write() call, the socket file descriptor, the buffer from which the message will be written, and the number of bytes to write. The fourth argument is an int argument called flags, which is normally zero. The fifth argument is a pointer to a sockadd_in structure. This will contain the address to which the message will be sent. Notice that in this case, since the server is replying to a message, the values of this structure were provided by the recvfrom call. The last argument is the size of this structure. Note that this is not a pointer to an int, but an int value itself. The sendto() man page has more information. The client code for a datagram socket client is the same as that for a stream socket with the following differences. * the socket system call has SOCK_DGRAM instead of SOCK_STREAM as its second argument. * there is no connect()**** system call * instead of read**** and write****, the client uses recvfrom**** and sendto **** which are described in detail above. Sockets in the Unix Domain Here is the code for a client and server which communicate using a stream socket in the Unix domain. U_server.c U_client The only difference between a socket in the Unix domain and a socket in the Internet domain is the form of the address. Here is the address structure for a Unix Domain address, defined in the header file. struct sockaddr_un short sun_family; /* AF_UNIX */ char sun_path[108]; /* path name (gag) */ ; The field sun_path has the form of a path name in the Unix file system. This means that both client and server have to be running the same file system. Once a socket has been created, it remain until it is explicitly deleted, and its name will appear with the ls command, always with a size of zero. Sockets in the Unix domain are virtually identical to named pipes (FIFOs). page 12 of 13

13 Designing servers There are a number of different ways to design servers. These models are discussed in detail in a book by Douglas E. Comer and David L. Stevens entiteld Internetworking with TCP/IP Volume III:Client Server Programming and Applications published by Prentice Hall in These are summarized here. Concurrent, connection oriented servers The typical server in the Internet domain creates a stream socket and forks off a process to handle each new connection that it receives. This model is appropriate for services which will do a good deal of reading and writing over an extended period of time, such as a telnet server or an ftp server. This model has relatively high overhead, because forking off a new process is a time consuming operation, and because a stream socket which uses the TCP protocol has high kernel overhead, not only in establishing the connection but also in transmitting information. However, once the connection has been established, data transmission is reliable in both directions. Iterative, connectionless servers Servers which provide only a single message to the client often do not involve forking, and often use a datagram socket rather than a stream socket. Examples include a finger daemon or a timeofday server or an echo server (a server which merely echoes a message sent by the client). These servers handle each message as it receives them in the same process. There is much less overhead with this type of server, but the communication is unreliable. A request or a reply may get lost in the Internet, and there is no built-in mechanism to detect and handle this. Single Process concurrent servers A server which needs the capability of handling several clients simultaneous, but where each connection is I/O dominated (i.e. the server spends most of its time blocked waiting for a message from the client) is a candidate for a single process, concurrent server. In this model, one process maintains a number of open connections, and listens at each for a message. Whenever it gets a message from a client, it replies quickly and then listens for the next one. This type of service can be done with the select system call. current rating: Support this site page 13 of 13

Introduction to Socket programming using C

Introduction to Socket programming using C Introduction to Socket programming using C Goal: learn how to build client/server application that communicate using sockets Vinay Narasimhamurthy S0677790@sms.ed.ac.uk CLIENT SERVER MODEL Sockets are

More information

Socket Programming. Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur

Socket Programming. Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur Socket Programming Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur Background Demultiplexing Convert host-to-host packet delivery service into a process-to-process communication channel

More information

Unix Network Programming

Unix Network Programming Introduction to Computer Networks Polly Huang EE NTU http://cc.ee.ntu.edu.tw/~phuang phuang@cc.ee.ntu.edu.tw Unix Network Programming The socket struct and data handling System calls Based on Beej's Guide

More information

Tutorial on Socket Programming

Tutorial on Socket Programming Tutorial on Socket Programming Computer Networks - CSC 458 Department of Computer Science Seyed Hossein Mortazavi (Slides are mainly from Monia Ghobadi, and Amin Tootoonchian, ) 1 Outline Client- server

More information

INTRODUCTION UNIX NETWORK PROGRAMMING Vol 1, Third Edition by Richard Stevens

INTRODUCTION UNIX NETWORK PROGRAMMING Vol 1, Third Edition by Richard Stevens INTRODUCTION UNIX NETWORK PROGRAMMING Vol 1, Third Edition by Richard Stevens Read: Chapters 1,2, 3, 4 Communications Client Example: Ex: TCP/IP Server Telnet client on local machine to Telnet server on

More information

VMCI Sockets Programming Guide VMware ESX/ESXi 4.x VMware Workstation 7.x VMware Server 2.0

VMCI Sockets Programming Guide VMware ESX/ESXi 4.x VMware Workstation 7.x VMware Server 2.0 VMware ESX/ESXi 4.x VMware Workstation 7.x VMware Server 2.0 This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition.

More information

Lab 4: Socket Programming: netcat part

Lab 4: Socket Programming: netcat part Lab 4: Socket Programming: netcat part Overview The goal of this lab is to familiarize yourself with application level programming with sockets, specifically stream or TCP sockets, by implementing a client/server

More information

Socket Programming. Request. Reply. Figure 1. Client-Server paradigm

Socket Programming. Request. Reply. Figure 1. Client-Server paradigm Socket Programming 1. Introduction In the classic client-server model, the client sends out requests to the server, and the server does some processing with the request(s) received, and returns a reply

More information

Introduction to Socket Programming Part I : TCP Clients, Servers; Host information

Introduction to Socket Programming Part I : TCP Clients, Servers; Host information Introduction to Socket Programming Part I : TCP Clients, Servers; Host information Keywords: sockets, client-server, network programming-socket functions, OSI layering, byte-ordering Outline: 1.) Introduction

More information

Network Programming with Sockets. Process Management in UNIX

Network Programming with Sockets. Process Management in UNIX Network Programming with Sockets This section is a brief introduction to the basics of networking programming using the BSD Socket interface on the Unix Operating System. Processes in Unix Sockets Stream

More information

TCP/IP - Socket Programming

TCP/IP - Socket Programming TCP/IP - Socket Programming jrb@socket.to.me Jim Binkley 1 sockets - overview sockets simple client - server model look at tcpclient/tcpserver.c look at udpclient/udpserver.c tcp/udp contrasts normal master/slave

More information

NS3 Lab 1 TCP/IP Network Programming in C

NS3 Lab 1 TCP/IP Network Programming in C NS3 Lab 1 TCP/IP Network Programming in C Dr Colin Perkins School of Computing Science University of Glasgow http://csperkins.org/teaching/ns3/ 13/14 January 2015 Introduction The laboratory exercises

More information

Socket Programming. Srinidhi Varadarajan

Socket Programming. Srinidhi Varadarajan Socket Programming Srinidhi Varadarajan Client-server paradigm Client: initiates contact with server ( speaks first ) typically requests service from server, for Web, client is implemented in browser;

More information

Session NM059. TCP/IP Programming on VMS. Geoff Bryant Process Software

Session NM059. TCP/IP Programming on VMS. Geoff Bryant Process Software Session NM059 TCP/IP Programming on VMS Geoff Bryant Process Software Course Roadmap Slide 160 NM055 (11:00-12:00) Important Terms and Concepts TCP/IP and Client/Server Model Sockets and TLI Client/Server

More information

Lecture 17. Process Management. Process Management. Process Management. Inter-Process Communication. Inter-Process Communication

Lecture 17. Process Management. Process Management. Process Management. Inter-Process Communication. Inter-Process Communication Process Management Lecture 17 Review February 25, 2005 Program? Process? Thread? Disadvantages, advantages of threads? How do you identify processes? How do you fork a child process, the child process

More information

Socket Programming in C/C++

Socket Programming in C/C++ September 24, 2004 Contact Info Mani Radhakrishnan Office 4224 SEL email mradhakr @ cs. uic. edu Office Hours Tuesday 1-4 PM Introduction Sockets are a protocol independent method of creating a connection

More information

Implementing Network Software

Implementing Network Software Implementing Network Software Outline Sockets Example Process Models Message Buffers Spring 2007 CSE 30264 1 Sockets Application Programming Interface (API) Socket interface socket : point where an application

More information

ELEN 602: Computer Communications and Networking. Socket Programming Basics

ELEN 602: Computer Communications and Networking. Socket Programming Basics 1 ELEN 602: Computer Communications and Networking Socket Programming Basics A. Introduction In the classic client-server model, the client sends out requests to the server, and the server does some processing

More information

Porting applications & DNS issues. socket interface extensions for IPv6. Eva M. Castro. ecastro@dit.upm.es. dit. Porting applications & DNS issues UPM

Porting applications & DNS issues. socket interface extensions for IPv6. Eva M. Castro. ecastro@dit.upm.es. dit. Porting applications & DNS issues UPM socket interface extensions for IPv6 Eva M. Castro ecastro@.upm.es Contents * Introduction * Porting IPv4 applications to IPv6, using socket interface extensions to IPv6. Data structures Conversion functions

More information

This tutorial has been designed for everyone interested in learning the data exchange features of Unix Sockets.

This tutorial has been designed for everyone interested in learning the data exchange features of Unix Sockets. About the Tutorial Sockets are communication points on the same or different computers to exchange data. Sockets are supported by Unix, Windows, Mac, and many other operating systems. The tutorial provides

More information

Application Architecture

Application Architecture A Course on Internetworking & Network-based Applications CS 6/75995 Internet-based Applications & Systems Design Kent State University Dept. of Science LECT-2 LECT-02, S-1 2 Application Architecture Today

More information

BSD Sockets Interface Programmer s Guide

BSD Sockets Interface Programmer s Guide BSD Sockets Interface Programmer s Guide Edition 6 B2355-90136 HP 9000 Networking E0497 Printed in: United States Copyright 1997 Hewlett-Packard Company. Legal Notices The information in this document

More information

Network Programming with Sockets. Anatomy of an Internet Connection

Network Programming with Sockets. Anatomy of an Internet Connection Network Programming with Sockets Anatomy of an Internet Connection Client socket address 128.2.194.242:51213 socket address 208.216.181.15:80 Client Connection socket pair (128.2.194.242:51213, 208.216.181.15:80)

More information

Java Programming: Sockets in Java

Java Programming: Sockets in Java Java Programming: Sockets in Java Manuel Oriol May 10, 2007 1 Introduction Network programming is probably one of the features that is most used in the current world. As soon as people want to send or

More information

IT304 Experiment 2 To understand the concept of IPC, Pipes, Signals, Multi-Threading and Multiprocessing in the context of networking.

IT304 Experiment 2 To understand the concept of IPC, Pipes, Signals, Multi-Threading and Multiprocessing in the context of networking. Aim: IT304 Experiment 2 To understand the concept of IPC, Pipes, Signals, Multi-Threading and Multiprocessing in the context of networking. Other Objective of this lab session is to learn how to do socket

More information

Writing a C-based Client/Server

Writing a C-based Client/Server Working the Socket Writing a C-based Client/Server Consider for a moment having the massive power of different computers all simultaneously trying to compute a problem for you -- and still being legal!

More information

Hostnames. HOSTS.TXT was a bottleneck. Once there was HOSTS.TXT. CSCE515 Computer Network Programming. Hierarchical Organization of DNS

Hostnames. HOSTS.TXT was a bottleneck. Once there was HOSTS.TXT. CSCE515 Computer Network Programming. Hierarchical Organization of DNS Hostnames CSCE 515: Computer Network Programming ------ Address Conversion Function and DNS RFC 1034, RFC 1035 Wenyuan Xu http://www.cse..edu/~wyxu/ce515f07.html Department of Computer Science and Engineering

More information

UNIX Sockets. COS 461 Precept 1

UNIX Sockets. COS 461 Precept 1 UNIX Sockets COS 461 Precept 1 Clients and Servers Client program Running on end host Requests service E.g., Web browser Server program Running on end host Provides service E.g., Web server GET /index.html

More information

Programmation Systèmes Cours 9 UNIX Domain Sockets

Programmation Systèmes Cours 9 UNIX Domain Sockets Programmation Systèmes Cours 9 UNIX Domain Sockets Stefano Zacchiroli zack@pps.univ-paris-diderot.fr Laboratoire PPS, Université Paris Diderot 2013 2014 URL http://upsilon.cc/zack/teaching/1314/progsyst/

More information

Concurrent Server Design Alternatives

Concurrent Server Design Alternatives CSCE 515: Computer Network Programming ------ Advanced Socket Programming Wenyuan Xu Concurrent Server Design Alternatives Department of Computer Science and Engineering University of South Carolina Ref:

More information

Lecture 7: Introduction to Sockets

Lecture 7: Introduction to Sockets Lecture 7: Introduction to Sockets References for Lecture 7: 1) Unix Network Programming, W.R. Stevens, 1990,Prentice-Hall, Chapter 6. 2) Unix Network Programming, W.R. Stevens, 1998,Prentice-Hall, Volume

More information

Elementary Name and Address. Conversions

Elementary Name and Address. Conversions Elementary Name and Address Domain name system Conversions gethostbyname Function RES_USE_INET6 resolver option gethostbyname2 Function and IPv6 support gethostbyaddr Function uname and gethostname Functions

More information

Interprocess Communication Message Passing

Interprocess Communication Message Passing Interprocess Communication Message Passing IPC facility provides two operations: send(message) message size fixed or variable receive(message) If P and Q wish to communicate, they need to: establish a

More information

CHAPTER 7. E-Mailing with CGI

CHAPTER 7. E-Mailing with CGI CHAPTER 7 E-Mailing with CGI OVERVIEW One of the most important tasks of any CGI program is ultimately to let someone know that something has happened. The most convenient way for users is to have this

More information

CSE 333 SECTION 6. Networking and sockets

CSE 333 SECTION 6. Networking and sockets CSE 333 SECTION 6 Networking and sockets Goals for Today Overview of IP addresses Look at the IP address structures in C/C++ Overview of DNS Write your own (short!) program to do the domain name IP address

More information

ICT SEcurity BASICS. Course: Software Defined Radio. Angelo Liguori. SP4TE lab. angelo.liguori@uniroma3.it

ICT SEcurity BASICS. Course: Software Defined Radio. Angelo Liguori. SP4TE lab. angelo.liguori@uniroma3.it Course: Software Defined Radio ICT SEcurity BASICS Angelo Liguori angelo.liguori@uniroma3.it SP4TE lab 1 Simple Timing Covert Channel Unintended information about data gets leaked through observing the

More information

CS162 Operating Systems and Systems Programming Lecture 4. Introduction to I/O (Continued), Sockets, Networking. Recall: Fork and Wait

CS162 Operating Systems and Systems Programming Lecture 4. Introduction to I/O (Continued), Sockets, Networking. Recall: Fork and Wait CS162 Operating Systems and Systems Programming Lecture 4 Introduction to I/O (Continued), Sockets, Networking February 2 nd, 2015 Prof. John Kubiatowicz http://cs162.eecs.berkeley.edu Recall: Fork and

More information

Elementary Name and Address Conversions

Elementary Name and Address Conversions Elementary Name and Address Conversions Domain name system gethostbyname Function RES_USE_INET6 resolver option gethostbyname2 Function and IPv6 support gethostbyaddr Function uname and gethostname Functions

More information

System calls. Problem: How to access resources other than CPU

System calls. Problem: How to access resources other than CPU System calls Problem: How to access resources other than CPU - Disk, network, terminal, other processes - CPU prohibits instructions that would access devices - Only privileged OS kernel can access devices

More information

UNIX. Sockets. mgr inż. Marcin Borkowski

UNIX. Sockets. mgr inż. Marcin Borkowski UNIX Sockets Introduction to Sockets Interprocess Communication channel: descriptor based two way communication can connect processes on different machines Three most typical socket types (colloquial names):

More information

Networks. Inter-process Communication. Pipes. Inter-process Communication

Networks. Inter-process Communication. Pipes. Inter-process Communication Networks Mechanism by which two processes exchange information and coordinate activities Inter-process Communication process CS 217 process Network 1 2 Inter-process Communication Sockets o Processes can

More information

An Introductory 4.4BSD Interprocess Communication Tutorial

An Introductory 4.4BSD Interprocess Communication Tutorial PSD:20-1 An Introductory 4.4BSD Interprocess Communication Tutorial Stuart Sechrest Computer Science Research Group Computer Science Division Department of Electrical Engineering and Computer Science University

More information

Computer Networks Network architecture

Computer Networks Network architecture Computer Networks Network architecture Saad Mneimneh Computer Science Hunter College of CUNY New York - Networks are like onions - They stink? - Yes, no, they have layers Shrek and Donkey 1 Introduction

More information

Implementing and testing tftp

Implementing and testing tftp CSE123 Spring 2013 Term Project Implementing and testing tftp Project Description Checkpoint: May 10, 2013 Due: May 29, 2013 For this project you will program a client/server network application in C on

More information

Transport Layer Protocols

Transport Layer Protocols Transport Layer Protocols Version. Transport layer performs two main tasks for the application layer by using the network layer. It provides end to end communication between two applications, and implements

More information

Limi Kalita / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 5 (3), 2014, 4802-4807. Socket Programming

Limi Kalita / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 5 (3), 2014, 4802-4807. Socket Programming Socket Programming Limi Kalita M.Tech Student, Department of Computer Science and Engineering, Assam Down Town University, Guwahati, India. Abstract: The aim of the paper is to introduce sockets, its deployment

More information

Network Programming. Chapter 11. 11.1 The Client-Server Programming Model

Network Programming. Chapter 11. 11.1 The Client-Server Programming Model Chapter 11 Network Programming Network applications are everywhere. Any time you browse the Web, send an email message, or pop up an X window, you are using a network application. Interestingly, all network

More information

The POSIX Socket API

The POSIX Socket API The POSIX Giovanni Agosta Piattaforme Software per la Rete Modulo 2 G. Agosta The POSIX Outline Sockets & TCP Connections 1 Sockets & TCP Connections 2 3 4 G. Agosta The POSIX TCP Connections Preliminaries

More information

A Client Server Transaction. Introduction to Computer Systems 15 213/18 243, fall 2009 18 th Lecture, Nov. 3 rd

A Client Server Transaction. Introduction to Computer Systems 15 213/18 243, fall 2009 18 th Lecture, Nov. 3 rd A Client Server Transaction Introduction to Computer Systems 15 213/18 243, fall 2009 18 th Lecture, Nov. 3 rd 4. Client handles response Client process 1. Client sends request 3. Server sends response

More information

Name and Address Conversions

Name and Address Conversions 11 Name and Address Conversions 11.1 Introduction All the examples so far in this text have used numeric addresses for the hosts (e.g., 206.6.226.33) and numeric port numbers to identify the servers (e.g.,

More information

IBM i Version 7.2. Programming Socket programming IBM

IBM i Version 7.2. Programming Socket programming IBM IBM i Version 7.2 Programming Socket programming IBM IBM i Version 7.2 Programming Socket programming IBM Note Before using this information and the product it supports, read the information in Notices

More information

TFTP Usage and Design. Diskless Workstation Booting 1. TFTP Usage and Design (cont.) CSCE 515: Computer Network Programming ------ TFTP + Errors

TFTP Usage and Design. Diskless Workstation Booting 1. TFTP Usage and Design (cont.) CSCE 515: Computer Network Programming ------ TFTP + Errors CSCE 515: Computer Network Programming ------ TFTP + Errors Wenyuan Xu Department of Computer Science and Engineering University of South Carolina TFTP Usage and Design RFC 783, 1350 Transfer files between

More information

DESIGN AND IMPLEMENT AND ONLINE EXERCISE FOR TEACHING AND DEVELOPMENT OF A SERVER USING SOCKET PROGRAMMING IN C

DESIGN AND IMPLEMENT AND ONLINE EXERCISE FOR TEACHING AND DEVELOPMENT OF A SERVER USING SOCKET PROGRAMMING IN C DESIGN AND IMPLEMENT AND ONLINE EXERCISE FOR TEACHING AND DEVELOPMENT OF A SERVER USING SOCKET PROGRAMMING IN C Elena Ruiz Gonzalez University of Patras University of Granada ERASMUS STUDENT:147 1/100

More information

Client / Server Programming with TCP/IP Sockets

Client / Server Programming with TCP/IP Sockets Client / Server Programming with TCP/IP Sockets Author: Rajinder Yadav Date: Sept 9, 2007 Revision: Mar 11, 2008 Web: http://devmentor.org Email: rajinder@devmentor.org Table of Content Networks... 2 Diagram

More information

Writing Client/Server Programs in C Using Sockets (A Tutorial) Part I. Session 5958. Greg Granger grgran@sas. sas.com. SAS/C & C++ Support

Writing Client/Server Programs in C Using Sockets (A Tutorial) Part I. Session 5958. Greg Granger grgran@sas. sas.com. SAS/C & C++ Support Writing Client/Server Programs in C Using Sockets (A Tutorial) Part I Session 5958 Greg Granger grgran@sas sas.com SAS Slide 1 Feb. 1998 SAS/C & C++ Support SAS Institute Part I: Socket Programming Overview

More information

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP CSCE 515: Computer Network Programming TCP/IP IP Network Layer Wenyuan Xu Department of Computer Science and Engineering University of South Carolina IP Datagrams IP is the network layer packet delivery

More information

Review of Previous Lecture

Review of Previous Lecture Review of Previous Lecture Principles of app layer protocols clients and servers app requirements Web and HTTP FTP Some slides are in courtesy of J. Kurose and K. Ross Announcement All got partners and

More information

transmission media and network topologies client/server architecture layers, protocols, and sockets

transmission media and network topologies client/server architecture layers, protocols, and sockets Network Programming 1 Computer Networks transmission media and network topologies client/server architecture layers, protocols, and sockets 2 Network Programming a simple client/server interaction the

More information

Operating Systems Design 16. Networking: Sockets

Operating Systems Design 16. Networking: Sockets Operating Systems Design 16. Networking: Sockets Paul Krzyzanowski pxk@cs.rutgers.edu 1 Sockets IP lets us send data between machines TCP & UDP are transport layer protocols Contain port number to identify

More information

Windows Socket Programming & IPv6 Translation Middleware

Windows Socket Programming & IPv6 Translation Middleware Windows Socket Programming IPv6 Translation Middleware Dr. Whai-En Chen VoIP and IPv6 Laboratory Research Assistant Professor Dept. of Computer Science and Information Engineering National Chiao Tung University

More information

Socket Programming in the Data Communications Laboratory

Socket Programming in the Data Communications Laboratory Socket Programming in the Data Communications Laboratory William E. Toll Assoc. Prof. Computing and System Sciences Taylor University Upland, IN 46989 btoll@css.tayloru.edu ABSTRACT Although many data

More information

DNS Domain Name System

DNS Domain Name System Domain Name System DNS Domain Name System The domain name system is usually used to translate a host name into an IP address Domain names comprise a hierarchy so that names are unique, yet easy to remember.

More information

Communication Networks. Introduction & Socket Programming Yuval Rochman

Communication Networks. Introduction & Socket Programming Yuval Rochman Communication Networks Introduction & Socket Programming Yuval Rochman Administration Staff Lecturer: Prof. Hanoch Levy hanoch AT cs tau Office hours: by appointment Teaching Assistant: Yuval Rochman yuvalroc

More information

A Client-Server Transaction. Systemprogrammering 2006 Föreläsning 8 Network Programming. Hardware Org of a Network Host.

A Client-Server Transaction. Systemprogrammering 2006 Föreläsning 8 Network Programming. Hardware Org of a Network Host. Systemprogrammering 2006 Föreläsning 8 Network Programming Topics -server programming model A -Server Transaction Every network application is based on the client-server model: A server process and one

More information

Networks class CS144 Introduction to Computer Networking Goal: Teach the concepts underlying networks Prerequisites:

Networks class CS144 Introduction to Computer Networking Goal: Teach the concepts underlying networks Prerequisites: CS144 Introduction to Computer Networking Instructors: Philip Levis and David Mazières CAs: Juan Batiz-Benet, Behram Mistree, Hariny Murli, Matt Sparks, and Tony Wu Section Leader: Aki Kobashi cs144-staff@scs.stanford.edu

More information

System Calls and Standard I/O

System Calls and Standard I/O System Calls and Standard I/O Professor Jennifer Rexford http://www.cs.princeton.edu/~jrex 1 Goals of Today s Class System calls o How a user process contacts the Operating System o For advanced services

More information

Packet Sniffing and Spoofing Lab

Packet Sniffing and Spoofing Lab SEED Labs Packet Sniffing and Spoofing Lab 1 Packet Sniffing and Spoofing Lab Copyright c 2014 Wenliang Du, Syracuse University. The development of this document is/was funded by the following grants from

More information

Overview. Socket Programming. Using Ports to Identify Services. UNIX Socket API. Knowing What Port Number To Use. Socket: End Point of Communication

Overview. Socket Programming. Using Ports to Identify Services. UNIX Socket API. Knowing What Port Number To Use. Socket: End Point of Communication Overview Socket Programming EE 122: Intro to Communication Networks Vern Paxson TAs: Lisa Fowler, Daniel Killebrew, Jorge Ortiz Socket Programming: how applications use the network Sockets are a C-language

More information

Carnegie Mellon. Internetworking. 15-213: Introduc0on to Computer Systems 19 th Lecture, Oct. 28, 2010. Instructors: Randy Bryant and Dave O Hallaron

Carnegie Mellon. Internetworking. 15-213: Introduc0on to Computer Systems 19 th Lecture, Oct. 28, 2010. Instructors: Randy Bryant and Dave O Hallaron Internetworking 15-213: Introduc0on to Computer Systems 19 th Lecture, Oct. 28, 2010 Instructors: Randy Bryant and Dave O Hallaron 1 A Client- Server Transac8on 4. Client handles response Client process

More information

sys socketcall: Network systems calls on Linux

sys socketcall: Network systems calls on Linux sys socketcall: Network systems calls on Linux Daniel Noé April 9, 2008 The method used by Linux for system calls is explored in detail in Understanding the Linux Kernel. However, the book does not adequately

More information

Remote login (Telnet):

Remote login (Telnet): SFWR 4C03: Computer Networks and Computer Security Feb 23-26 2004 Lecturer: Kartik Krishnan Lectures 19-21 Remote login (Telnet): Telnet permits a user to connect to an account on a remote machine. A client

More information

RARP: Reverse Address Resolution Protocol

RARP: Reverse Address Resolution Protocol SFWR 4C03: Computer Networks and Computer Security January 19-22 2004 Lecturer: Kartik Krishnan Lectures 7-9 RARP: Reverse Address Resolution Protocol When a system with a local disk is bootstrapped it

More information

An Overview of IPv6 CHAPTER

An Overview of IPv6 CHAPTER 56982_CH02I 12/12/97 3:29 PM Page 23 2 CHAPTER 2 An Overview of IPv6 This second chapter is meant to provide a general overview of the IPv6 protocol and of the way network layer protocols operate. These

More information

2057-15. First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring

2057-15. First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring 2057-15 First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring 7-25 September 2009 TCP/IP Networking Abhaya S. Induruwa Department

More information

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version Version 3.5 JEFFERSON LAB Data Acquisition Group cmsg Developer s Guide J E F F E R S O N L A B D A T A A C Q U I S I T I O N G R O U P cmsg Developer s Guide Elliott Wolin wolin@jlab.org Carl Timmer timmer@jlab.org

More information

Giving credit where credit is due

Giving credit where credit is due JDEP 284H Foundations of Computer Systems Internetworking Dr. Steve Goddard goddard@cse.unl.edu Giving credit where credit is due Most of slides for this lecture are based on slides created by Drs. Bryant

More information

An Advanced 4.4BSD Interprocess Communication Tutorial

An Advanced 4.4BSD Interprocess Communication Tutorial An Advanced 4.4BSD Interprocess Communication Tutorial Samuel J. Leffler Robert S. Fabry William N. Joy Phil Lapsley Computer Systems Research Group Department of Electrical Engineering and Computer Science

More information

Lecture 21: Networking & Protocol Stacks

Lecture 21: Networking & Protocol Stacks CS 422/522 Design & Implementation of Operating Systems Lecture 21: Networking & Protocol Stacks Zhong Shao Dept. of Computer Science Yale University Acknowledgement: some slides are taken from previous

More information

q Connection establishment (if connection-oriented) q Data transfer q Connection release (if conn-oriented) q Addressing the transport user

q Connection establishment (if connection-oriented) q Data transfer q Connection release (if conn-oriented) q Addressing the transport user Transport service characterization The Transport Layer End-to-End Protocols: UDP and TCP Connection establishment (if connection-oriented) Data transfer Reliable ( TCP) Unreliable / best effort ( UDP)

More information

CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17

CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17 CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17 System Calls for Processes Ref: Process: Chapter 5 of [HGS]. A program in execution. Several processes are executed concurrently by the

More information

Understanding TCP/IP. Introduction. What is an Architectural Model? APPENDIX

Understanding TCP/IP. Introduction. What is an Architectural Model? APPENDIX APPENDIX A Introduction Understanding TCP/IP To fully understand the architecture of Cisco Centri Firewall, you need to understand the TCP/IP architecture on which the Internet is based. This appendix

More information

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2 SMTP-32 Library Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows Version 5.2 Copyright 1994-2003 by Distinct Corporation All rights reserved Table of Contents 1 Overview... 5 1.1

More information

Objectives of Lecture. Network Architecture. Protocols. Contents

Objectives of Lecture. Network Architecture. Protocols. Contents Objectives of Lecture Network Architecture Show how network architecture can be understood using a layered approach. Introduce the OSI seven layer reference model. Introduce the concepts of internetworking

More information

The exam has 110 possible points, 10 of which are extra credit. There is a Word Bank on Page 8. Pages 7-8 can be removed from the exam.

The exam has 110 possible points, 10 of which are extra credit. There is a Word Bank on Page 8. Pages 7-8 can be removed from the exam. CS326e Spring 2014 Midterm Exam Name SOLUTIONS UTEID The exam has 110 possible points, 10 of which are extra credit. There is a Word Bank on Page 8. Pages 7-8 can be removed from the exam. 1. [4 Points]

More information

IP - The Internet Protocol

IP - The Internet Protocol Orientation IP - The Internet Protocol IP (Internet Protocol) is a Network Layer Protocol. IP s current version is Version 4 (IPv4). It is specified in RFC 891. TCP UDP Transport Layer ICMP IP IGMP Network

More information

Linux Kernel Architecture

Linux Kernel Architecture Linux Kernel Architecture Amir Hossein Payberah payberah@yahoo.com Contents What is Kernel? Kernel Architecture Overview User Space Kernel Space Kernel Functional Overview File System Process Management

More information

15-441 Project 3, Fall 2001 Stateful Functionality in IP Layer Out: Thursday, November 1, 2001 Due: Tuesday, December 4, 2001

15-441 Project 3, Fall 2001 Stateful Functionality in IP Layer Out: Thursday, November 1, 2001 Due: Tuesday, December 4, 2001 15-441 Project 3, Fall 2001 Stateful Functionality in IP Layer Out: Thursday, November 1, 2001 Due: Tuesday, December 4, 2001 1. Introduction In Project 2 we asked you to implement the IP layer of the

More information

The Good, the Bad, and the Ugly: The Unix Legacy

The Good, the Bad, and the Ugly: The Unix Legacy The Good, the Bad, and the Ugly: The Unix Legacy Rob Pike Bell Labs Lucent Technologies rob@plan9.bell labs.com Copenhagen Sept 8-9 2001 +1000000000s 1972 1 The number of UNIX installations has grown to

More information

Network Programming TDC 561

Network Programming TDC 561 Network Programming TDC 561 Lecture # 1 Dr. Ehab S. Al-Shaer School of Computer Science & Telecommunication DePaul University Chicago, IL 1 Network Programming Goals of this Course: Studying, evaluating

More information

CPS221 Lecture: Layered Network Architecture

CPS221 Lecture: Layered Network Architecture CPS221 Lecture: Layered Network Architecture Objectives last revised 9/10/12 1. To discuss the OSI layered architecture model 2. To discuss the specific implementation of this model in TCP/IP Materials:

More information

The difference between TCP/IP, UDP/IP and Multicast sockets. How servers and clients communicate over sockets

The difference between TCP/IP, UDP/IP and Multicast sockets. How servers and clients communicate over sockets Network Programming Topics in this section include: What a socket is What you can do with a socket The difference between TCP/IP, UDP/IP and Multicast sockets How servers and clients communicate over sockets

More information

Project 1: Implement a simple hosts framework using UNIX TCP Sockets to demonstrate the concept of Mobile Agents

Project 1: Implement a simple hosts framework using UNIX TCP Sockets to demonstrate the concept of Mobile Agents Project 1: Implement a simple hosts framework using UNIX TCP Sockets to demonstrate the concept of Mobile Agents Due date: October 15 (Monday), 2007 Requirements This exercise should be done individually.

More information

Generalised Socket Addresses for Unix Squeak 3.9 11

Generalised Socket Addresses for Unix Squeak 3.9 11 Generalised Socket Addresses for Unix Squeak 3.9 11 Ian Piumarta 2007 06 08 This document describes several new SocketPlugin primitives that allow IPv6 (and arbitrary future other) address formats to be

More information

File Transfer And Access (FTP, TFTP, NFS) Chapter 25 By: Sang Oh Spencer Kam Atsuya Takagi

File Transfer And Access (FTP, TFTP, NFS) Chapter 25 By: Sang Oh Spencer Kam Atsuya Takagi File Transfer And Access (FTP, TFTP, NFS) Chapter 25 By: Sang Oh Spencer Kam Atsuya Takagi History of FTP The first proposed file transfer mechanisms were developed for implementation on hosts at M.I.T.

More information

Transport Layer. Chapter 3.4. Think about

Transport Layer. Chapter 3.4. Think about Chapter 3.4 La 4 Transport La 1 Think about 2 How do MAC addresses differ from that of the network la? What is flat and what is hierarchical addressing? Who defines the IP Address of a device? What is

More information

Programming With Sockets 2

Programming With Sockets 2 Programming With Sockets 2 This chapter presents the socket interface and illustrates them with sample programs. The programs demonstrate the Internet domain sockets. What Are Sockets page 12 Socket Tutorial

More information

Procedure: You can find the problem sheet on Drive D: of the lab PCs. 1. IP address for this host computer 2. Subnet mask 3. Default gateway address

Procedure: You can find the problem sheet on Drive D: of the lab PCs. 1. IP address for this host computer 2. Subnet mask 3. Default gateway address Objectives University of Jordan Faculty of Engineering & Technology Computer Engineering Department Computer Networks Laboratory 907528 Lab.4 Basic Network Operation and Troubleshooting 1. To become familiar

More information

1 Abstract Data Types Information Hiding

1 Abstract Data Types Information Hiding 1 1 Abstract Data Types Information Hiding 1.1 Data Types Data types are an integral part of every programming language. ANSI-C has int, double and char to name just a few. Programmers are rarely content

More information

CS 213, Fall 2000 Lab Assignment L5: Logging Web Proxy Assigned: Nov. 28, Due: Mon. Dec. 11, 11:59PM

CS 213, Fall 2000 Lab Assignment L5: Logging Web Proxy Assigned: Nov. 28, Due: Mon. Dec. 11, 11:59PM CS 213, Fall 2000 Lab Assignment L5: Logging Web Proxy Assigned: Nov. 28, Due: Mon. Dec. 11, 11:59PM Jason Crawford (jasonc@cs.cmu.edu) is the lead person for this assignment. Introduction A web proxy

More information

EXTENDED FILE SYSTEM FOR F-SERIES PLC

EXTENDED FILE SYSTEM FOR F-SERIES PLC EXTENDED FILE SYSTEM FOR F-SERIES PLC Before you begin, please download a sample I-TRiLOGI program that will be referred to throughout this manual from our website: http://www.tri-plc.com/trilogi/extendedfilesystem.zip

More information