Programming Requirements. Project & Programming Overview. Local Repository SVN 1/10/2011. Version Control: SVN Makefiles Development Language: C only

Size: px
Start display at page:

Download "Programming Requirements. Project & Programming Overview. Local Repository SVN 1/10/2011. Version Control: SVN Makefiles Development Language: C only"

Transcription

1 Programming Requirements Project & Programming Overview Version Control: SVN Makefiles Development Language: C only Spring 2011 Local Repository SVN To create a repository: svnadmin create --fs-type fsfs /home/user/svn Create your working directory (/path/to/dir/)with the following subdirectories as a convention: branches/, tags/ and trunk/ Main line of development is the /trunk directory To import your working directory to the repository: svn import /path/to/dir/trunk file:///home/user/svn/myproject - m "initial import" 1

2 Local Repository (cont) Local Repository (cont) To have a working directory under version control, you need to check out the imported files from the repo. You and your partner can both checkout separate working copies. svn checkout file:///home/user/svn/myproject/trunk myproject You can now edit files in your working directory. SVN will keep track of your changes. To commit/replace a new version of files in your working directory use command: svn commit To get the latest changes to the repository use the command: svn update Use the m flag to make short but useful comments on what each version has changed You and your partner can work on separate files and commit your changes separately without affecting the other. Local Repository (cont) If you are working on the same file, you should each create a branch in your own directories by using the command: svn copy /path/to/dir/myproject/trunk \ /path/to/dir/myproject/branches/my-branch \ -m "Creating a private branch of /calc/trunk. Make incremental changes and merge your branch to the trunk. From your my-branch svn merge /path/to/dir/myproject/trunk The trunk should now have the changes from your branch Local Repository (cont) It is a good habit to (and you should) update your trunk before committing, copying or merging any changes to the repository. This ensures you have the latest version working version before you make changes and avoids many bugs and headaches. 2

3 make Makefiles make is a gnu utility used for the purpose of recompiling. It only compiles objects that have changed since the last compilation, hence saving precious time. Make uses the rules described in the Makefile found in the current working directory. The makefile must be named Makefile Example Makefile CC=gcc CFLAGS= -ansi -Wall LDFLAGS= OBJS= example.o example_functions.o \ foo.o foo_helper.o EXE= test Network Programming.c.o: $(CC) $(CFLAGS) -c $< -o $@ all: $(OBJS) $(CC) $(LDFLAGS) $(OBJS) -o $(EXE) clean: rm -f $(OBJS) $(EXE) 3

4 Socket API API (Application Programming Interface) Provides a standard set of functions that can be called by applications Berkeley UNIX Sockets API (C) Abstraction for applications to send & receive data Applications create sockets that plug into network Applications write/read to/from sockets Implemented in the kernel Facilitates development of network applications Hides details of underlying protocols & mechanisms Also in Windows, Linux, and other OS s Socket API is also available in Java (java.net.socket) Communications through Socket Interface Socket interface descriptor port number Application 1 Socket Underlying communication protocols User Kernel User Kernel Socket Application references a socket through a descriptor Socket bound to a port number Application 2 Underlying communication protocols Socket interface descriptor port number Communications network Stream mode of service & Differences ion-oriented First, setup connection between two peer application processes Then, reliable bidirectional insequence transfer of byte stream Multiple write/read between peer processes Finally, connection release Uses TCP ionless (gram) Immediate transfer of one block of information No setup overhead & delay Destination address with each block Send/receive to/from multiple peer processes Best-effort service only Possible out-of-order Possible loss Uses UDP Specifies well-known port # when creating socket May have multiple IP addresses (net interfaces) Waits passively for client requests Assigned ephemeral port # Initiates communications with server Needs to know server s IP address & port # DNS for URL & server well-known port # learns client s address & port # Peer-to-Peer A process performs as both server and client 4

5 Socket Calls for ion-oriented Mode Socket Calls for ion-oriented Mode does Passive Open socket creates socket to listen for connection requests specifies type: TCP (stream) socket call returns: non-negative integer descriptor; or -1 if unsuccessful does Passive Open bind assigns local address & port # to socket with specified descriptor Can wildcard IP address for multiple net interfaces bind call returns: 0 (success); or -1 (failure) Failure if port # already in use or if reuse option not set Socket Calls for ion-oriented Mode does Passive Open listen indicates TCP readiness to receive connection requests for socket with given descriptor Parameter specifies file descriptor and max number of requests that may be queued while waiting for processing (backlog) listen call returns: 0 (success); or -1 (failure) Java: the backlog size is specified thru bind Socket Calls for ion-oriented Mode does Passive Open calls accept to accept incoming requests accept blocks if queue is empty 5

6 Socket Calls for ion-oriented Mode Socket Calls for ion-oriented Mode does Active Open socket creates socket to connect to server specifies type: TCP (stream) socket call returns: non-negative integer descriptor; or -1 if unsuccessful does Active Open connect establishes a connection on the local socket with the specified descriptor to the specified remote address and port # connect returns 0 if successful; -1 if unsuccessful Note: connect initiates TCP three-way handshake Socket Calls for ion-oriented Mode Socket Calls for ion-oriented Mode acceptwakes with incoming connection request acceptfills client address & port # into address structure acceptcall returns: descriptor of new connection socket (success); or -1 (failure) & server use new socket for data transfer Original socket continues to listen for new requests Transfer or server call write to transmit data into a connected socket write specifies: socket descriptor; pointer to a buffer; amount of data; flags to control transmission behavior write call returns: # bytes transferred (success); or -1 (failure); blocks until all data transferred 6

7 Socket Calls for ion-oriented Mode Socket Calls for ion-oriented Mode Transfer or server call read to receive data from a connected socket read specifies: socket descriptor; pointer to a buffer; amount of data read call returns: # bytes read (success); or -1 (failure); blocks if no data arrives Note: write and read can be called multiple times to transfer byte streams in both directions ion Termination or server call close when socket is no longer needed close specifies the socket descriptor close call returns: 0 (success); or -1 (failure) Note: close initiates TCP graceful close sequence Example: TCP Echo Example: TCP Echo /* A simple echo server using TCP */ #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #define SERVER_TCP_PORT 3000 #define BUFLEN 256 int main(int argc, char **argv) { int n, bytes_to_read; int sd, new_sd, client_len, port; struct sockaddr_in server, client; char *bp, buf[buflen]; /* Create a stream socket, last parameter is the protocol 0 = any (usually, there s only one for a protocol family) */ if ((sd = socket(pf_inet, SOCK_STREAM, 0)) == -1) { fprintf(stderr, "Can't create a socket\n"); /* Bind an address to the socket */ bzero((char *)&server, sizeof(struct sockaddr_in)); server.sin_family = AF_INET; server.sin_port = htons(server_tcp_port); server.sin_addr.s_addr = htonl(inaddr_any); if (bind(sd, (struct sockaddr *)&server, sizeof(server)) == -1) { fprintf(stderr, "Can't bind name to socket\n"); /* queue up to 5 connect requests */ listen(sd, 5); while (1) { client_len = sizeof(client); if ((new_sd = accept(sd, (struct sockaddr *)&client, &client_len)) == -1) { fprintf(stderr, "Can't accept client\n"); bp = buf; bytes_to_read = BUFLEN; while ((n = read(new_sd, bp, bytes_to_read)) > 0) { bp += n; bytes_to_read -= n; printf("rec'd: %s\n", buf); write(new_sd, buf, BUFLEN); printf("sent: %s\n", buf); close(new_sd); close(sd); return(0); /* A simple TCP client */ #include <stdio.h> #include <netdb.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #define SERVER_TCP_PORT 3000 #define BUFLEN 256 int main(int argc, char **argv) { int n, bytes_to_read; int sd, port; struct hostent *hp; struct sockaddr_in server; char *host, *bp, rbuf[buflen], sbuf[buflen]; switch(argc) { case 2: host = argv[1]; port = SERVER_TCP_PORT; break; case 3: host = argv[1]; port = atoi(argv[2]); break; default: fprintf(stderr, "Usage: %s host [port]\n", argv[0]); /* Create a stream socket */ if ((sd = socket(pf_inet, SOCK_STREAM, 0)) == -1) { fprintf(stderr, "Can't create a socket\n"); bzero((char *)&server, sizeof(struct sockaddr_in)); server.sin_family = AF_INET; server.sin_port = htons(port); if ((hp = gethostbyname(host)) == NULL) { fprintf(stderr, "Can't get server's address\n"); bcopy(hp->h_addr, (char *)&server.sin_addr, hp->h_length); /* ing to the server */ if (connect(sd, (struct sockaddr *)&server, sizeof(server)) == -1) { fprintf(stderr, "Can't connect\n"); printf("ed: server's address is %s\n", hp->h_name); printf("transmit:\n"); gets(sbuf); write(sd, sbuf, BUFLEN); printf("receive:\n"); bp = rbuf; bytes_to_read = BUFLEN; while ((n = read(sd, bp, bytes_to_read)) > 0) { bp += n; bytes_to_read -= n; printf("%s\n", rbuf); close(sd); return(0); 7

8 Socket Calls for ion-less Mode Socket Calls for ion-less Mode until server receives data from client started socket creates socket of type UDP (datagram) socket call returns: descriptor; or -1 if unsuccessful bind assigns local address & port # to socket with specified descriptor; Can wildcard IP address until server receives data from client recvfrom copies bytes received in specified socket into a specified location recvfrom blocks until data arrives Socket Calls for ion-less Mode until server receives data from client started socket creates socket of type UDP (datagram) socket call returns: descriptor; or -1 if unsuccessful Socket Calls for ion-less Mode until server receives data from client started sendto transfer bytes in buffer to specified socket sendto specifies: socket descriptor; pointer to a buffer; amount of data; flags to control transmission behavior; destination address & port #; length of destination address structure sendto returns: # bytes sent; or -1 if unsuccessful 8

9 Socket Calls for ion-less Mode Socket Calls for ion-less Mode until server receives data from client recvfrom wakes when data arrives recvfrom specifies: socket descriptor; pointer to a buffer to put data; max # bytes to put in buffer; control flags; copies: sender address & port #; length of sender address structure recvfrom returns # bytes received or -1 (failure) Note: receivefrom returns data from at most one send, i.e. from one datagram until server receives data from client Socket Close or server call close when socket is no longer needed close specifies the socket descriptor close call returns: 0 (success); or -1 (failure) Example: UDP Echo /* Echo server using UDP */ /* Bind an address to the socket */ #include <stdio.h> bzero((char *)&server, sizeof(server)); #include <sys/types.h> server.sin_family = AF_INET; #include <sys/socket.h> server.sin_port = htons(port); #include <netinet/in.h> server.sin_addr.s_addr = htonl(inaddr_any); if (bind(sd, (struct sockaddr *)&server, #define SERVER_UDP_PORT 5000 sizeof(server)) == -1) { #define MAXLEN 4096 fprintf(stderr, "Can't bind name to socket\n"); int main(int argc, char **argv) { int sd, client_len, port, n; while (1) { char buf[maxlen]; client_len = sizeof(client); struct sockaddr_in server, client; if ((n = recvfrom(sd, buf, MAXLEN, 0, (struct sockaddr *)&client, &client_len)) < 0) { switch(argc) { fprintf(stderr, "Can't receive datagram\n"); case 1: port = SERVER_UDP_PORT; break; case 2: if (sendto(sd, buf, n, 0, port = atoi(argv[1]); (struct sockaddr *)&client, client_len)!= n) { break; fprintf(stderr, "Can't send datagram\n"); default: fprintf(stderr, "Usage: %s [port]\n", argv[0]); close(sd); return(0); /* Create a datagram socket */ if ((sd = socket(pf_inet, SOCK_DGRAM, 0)) == -1) { fprintf(stderr, "Can't create a socket\n"); Example: UDP Echo #include <stdio.h> #include <string.h> #include <sys/time.h> else { #include <netdb.h> fprintf(stderr, #include <sys/types.h> "Usage: %s [-s data_size] host [port]\n", pname); #include <sys/socket.h> #include <netinet/in.h> #define SERVER_UDP_PORT 5000 #define MAXLEN 4096 if ((sd = socket(pf_inet, SOCK_DGRAM, 0)) == -1) { #define DEFLEN 64 fprintf(stderr, "Can't create a socket\n"); long delay(struct timeval t1, struct timeval t2) { bzero((char *)&server, sizeof(server)); long d; server.sin_family = AF_INET; d = (t2.tv_sec - t1.tv_sec) * 1000; server.sin_port = htons(port); d += ((t2.tv_usec - t1.tv_usec + 500) / 1000); if ((hp = gethostbyname(host)) == NULL) { return(d); fprintf(stderr, "Can't get server's IP address\n"); int main(int argc, char **argv) { bcopy(hp->h_addr, (char *) &server.sin_addr, hp->h_length); int data_size = DEFLEN, port = SERVER_UDP_PORT; int i, j, sd, server_len; if (data_size > MAXLEN) { char *pname, *host, rbuf[maxlen], sbuf[maxlen]; fprintf(stderr, " is too big\n"); struct hostent *hp; struct sockaddr_in server; struct timeval start, end; for (i = 0; i < data_size; i++) { unsigned long address; j = (i < 26)? i : i % 26; sbuf[i] = 'a' + j; pname = argv[0]; argc--; gettimeofday(&start, NULL); /* start delay measurement */ argv++; server_len = sizeof(server); if (argc > 0 && (strcmp(*argv, "-s") == 0)) { if (sendto(sd, sbuf, data_size, 0, (struct sockaddr *) if (--argc > 0 && (data_size = atoi(*++argv))) { &server, server_len) == -1) { argc--; fprintf(stderr, "sendto error\n"); argv++; else { if (recvfrom(sd, rbuf, MAXLEN, 0, (struct sockaddr *) fprintf(stderr, &server, &server_len) < 0) { "Usage: %s [-s data_size] host [port]\n", pname); fprintf(stderr, "recvfrom error\n"); gettimeofday(&end, NULL); /* end delay measurement */ if (argc > 0) { if (strncmp(sbuf, rbuf, data_size)!= 0) host = *argv; printf(" is corrupted\n"); if (--argc > 0) close(sd); port = atoi(*++argv); return(0); 9

10 Byte-Ordering How to store multiple bytes in memory? Consider a 32 bit number 1A2B3C4D 16 Big-endian: most significant byte first 1A 2B 3C 4D Little-endian: least significant byte first 4D 3C 2B 1A Cause troubles for multi-byte numbers and characters The network agrees on Big-endian Network Byte Order The hosts not so much Host Byte Order Programming implications C: use conversion functions; htons(), htonl(), ntohs(), ntohl() Java: do nothing, JVM I/O always uses network byte order Model Blocking One connection at a time Thread/Process-per-connection Spawn a worker thread/process per connection Resource intensive I/O Multiplex Single process model Application maintains client state (complex) Good performance / low resource listen accept read Process write Blocking One connection at a time Simple Users must wait when there are multiple connections listen accept pthread_create() / fork() Thread per connection read Process write Fork/create thread once the connection is accepted Handle multiple connections concurrently Resource limited by the number of processes/threads spawned close close exit 10

11 bind/listen I/O Multiplex C select() accept FD_SET R register/fd_set select() FD_ISSET read Process write close Use select() to pick available socket operations Subdivide operations based on I/O type Application handles the association between current client states and the I/O being selected /* select.c -- a select() demo * This codes will wait 2.5 seconds for a key-pressed */ #include <stdio.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #define STDIN 0 // file descriptor for standard input int main(void) { struct timeval tv; fd_set readfds; tv.tv_sec = 2; tv.tv_usec = ; FD_ZERO(&readfds); FD_SET(STDIN, &readfds); // First argument = max fd + 1 select(stdin+1, &readfds, NULL, NULL, &tv); if (FD_ISSET(STDIN, &readfds)) printf("a key was pressed!\n"); else printf("timed out.\n"); return 0; Block until one of the waited operations is ready Use file descriptor as the selection key Three key sets Read set (include accept) Write set Exceptions FD_SET W FD_CLR RW Project Project Overview 35 % of your grade [+possible extra credit] 1-2 person team (preferably 2 people) Find (your buddy) and your team name Choice of programming languages: C us by Jan 15 23:59 EST 4 projects over the semester Build upon previous projects Need your last project to move on Start early! Testing will be critical Your server will eventually talk with ours over the network 11

12 Project Overview Video-on-demand HTTP P2P Backend P2P Video-on-Demand Distributed YouTube Eventually grows to a full peer-to-peer VoD system Apply network concepts Socket/ programming Congestion control Failure detection/recovery + Bonus credit from class competition Video on demand View what you want whenever you want Usually not live stream Content serves from a single provider Not necessary from the same server Content Distribution Network Service providers have many servers distributed geographically Contents are duplicated from the master server to other locations Content is served from a single server located near the client Need to concern about what/where/when to duplicate the contents P2P Video-on-demand Peer-to-Peer network All nodes provide resource (bandwidth, content) Many nodes may share the same(popular) contents P2P Video on demand Need to be able to query and locate the desired content s may concurrently send/retrieve content to/from multiple peers Performance consideration (open for competition) Content search time Content retrieval time Content ready-to-view time Network bandwidth required 12

13 Projects HTTP Pseudo Streaming Project1 HTTP Pseudo Streaming Concurrent video streaming HTTP server Project2 Transport System Backend UDP P2P transport infrastructure Project3 Peer Network Link-state routing protocol Project4 Content Search Distributed content search among peers requests metadata part of the content Usually at the beginning of the file downloads the content to its buffer and starts playing the media Same as downloading any HTTP content Content seek provided by selectively downloading parts of the content Compatible HTTP server support partial byterange requests for the content Our P2P VoD Daemon Project 1: HTTP-streaming server Local File UI / Html HTTP Request Handler Content request Peer Process Peer status/discovery Content search Video Project 1 Video Transfer Content transfer Error control Peer Peer Peer Peer HTTP w/byte range request support HTTP P2P Backend HTML 5-capable browsers (Firefox, Chrome) provide built-in video clients (HTTP pseudo streaming) Our first task is to provide an effective way to transfer our buffered video to browsers Introduction to socket & server programming Partial HTTP implementation (with byte range request) You should be able to run the server on a cluster machine and view your video on a laptop Performance index Maximize number of simultaneous viewers (no. clients whose can retrieve X bytes within Y seconds after connection initiation) The score will heavily depend on your server design 13

14 Hypertext Transfer Protocol HTTP Protocol HTTP provides communications between web browsers & web servers Web: framework for accessing documents & resources Hypertext documents: text, graphics, images, hyperlinks RFC 1945 (HTTP 1.0), RFC 2616 (HTTP 1.1) You will implement a subset of HTTP 1.1 Documents prepared using Hypertext Markup Language (HTML) HTML 5 introduces embedded media tag <video>,<audio> Supported browsers: Firefox, Chrome HTTP servers use well-known port 80 request / reply Stateless does not keep any information about client Each request is independent HTTP 1.0 Non-persistent connection Create new TCP connection per request/reply HTTP 1.1 Persistent connection by default Subsequent request/reply performed on the same connection Used in today s browser/web server HTTP Typical Exchange HTTP Message Formats HTTP messages written in ASCII text Request Message Format Request Line (Each line ends with carriage return + line feed) Method URL HTTP-Version\r\n Method specifies action to apply to object URL specifies object Header Lines (Ea. line ends with carriage return + line feed) AttributeName: AttributeValue \r\n E.g. type of client, content, identity of requester, Last header line has extra carriage return + line feed (\r\n) Entity Body (Content, optional) Additional information to server Minimal HTTP 1.1 request GET /path/file.html HTTP/1.1 Host: [blank line here] 14

15 HTTP Request Methods Universal Resource Locator Request method GET HEAD POST PUT DELETE TRACE OPTIONS Meaning Retrieve information (object) identified by the URL. Retrieve meta-information about the object, but do not transfer the object; Can be used to find out if a document has changed. Send information to a URL (using the entity body) and retrieve result; used when a user fills out a form in a browser. Store information in location named by URL Remove object identified by URL Trace HTTP forwarding through proxies, tunnels, etc. Used to determine the capabilities of the server, or characteristics of a named resource. Absolute URL scheme://hostname[:port]/path Relative URL /path / HTTP Request Message HTTP Response Message Response Message Format Status Line HTTP-Version Status-Code Message Status Code: 3-digit code indicating result E.g. HTTP/ OK E.g. HTTP/ NOT FOUND Headers Section Information about object transferred to client E.g. server type, content length, content type, Content Object (document) Sample Response HTTP/ OK Date: Fri, 31 Dec :59:59 EST Content-Type: text/plain Content-Length: 42 abcdefghijklmnopqrstuvwxyz abcdef 15

16 HTTP Response Message References HTTP Made Really Easy HTTP/1.1 Specification Beej Guide to Network Programming

Chapter 2 Applications and

Chapter 2 Applications and Chapter 2 Applications and ed Architectures Protocols, Services & ing OSI Reference Model TCP/IP Architecture How the s Work Together Berkeley Sockets Application Protocols & Utilities 1 s, Services &

More information

Interprocess Communication

Interprocess Communication Interprocess Communication Dr. Xiaobo Zhou Adopted from Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, Addison-Wesley 2005 1/14/2008 1 Middleware Layers Applications,

More information

Hyo-bong Son Computer Systems Laboratory Sungkyunkwan University

Hyo-bong Son Computer Systems Laboratory Sungkyunkwan University Sockets Hyo-bong Son (proshb@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Client-Server Model Most network application is based on the client-server model: A server

More information

Sockets. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Sockets. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Sockets Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Internet Connections (1) Connection Clients and servers communicate by sending streams of

More information

Chapter 2 Applications and

Chapter 2 Applications and Chapter 2 Applications and Layered Architectures Sockets Socket API API (Application Programming Interface) Provides a standard set of functions that can be called by applications Berkeley UNIX Sockets

More information

The User Datagram Protocol

The User Datagram Protocol The User Datagram Protocol Stefan D. Bruda Winter 2018 UDP Very similar to the TCP in terms of API Dissimilar with TCP in terms of innards (and hence programming techniques) Many-to-many communication.

More information

The BSD UNIX Socket Interface (CS 640 Lecture) Assignment 1. Interprocess Communication (IPC) Work Individually (no groups)

The BSD UNIX Socket Interface (CS 640 Lecture) Assignment 1. Interprocess Communication (IPC) Work Individually (no groups) The BSD UNIX Socket Interface (CS 640 Lecture) Assignment 1 Work Individually (no groups) Due Date: in class, Monday, September 19 Robert T Olsen olsen@cswiscedu 7390CS Office Hours: 3-5T, 11-12F - exception

More information

1 /* client.c - adapted from code for example client program that uses TCP */ 2 /*Modified by Vincent Chu, Winter

1 /* client.c - adapted from code for example client program that uses TCP */ 2 /*Modified by Vincent Chu, Winter 1 /* client.c - adapted from code for example client program that uses TCP */ 2 /*Modified by Vincent Chu, Winter 2004. 3 http://www.sfu.ca/~vwchu 4 chuvincent (at) gmail (dot) com 5 */ 6 7 #define closesocket

More information

UDP CONNECT TO A SERVER

UDP CONNECT TO A SERVER UDP The User Datagram Protocol Stefan D. Bruda Winter 2018 Very similar to the TCP in terms of API Dissimilar with TCP in terms of innards (and hence programming techniques) Many-to-many communication.

More information

Sockets. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University Embedded Software Lab.

Sockets. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University  Embedded Software Lab. 1 Sockets Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University http://nyx.skku.ac.kr Internet Connections (1) 2 Connection Clients and servers communicate by sending streams of bytes over

More information

Socket Programming. CSIS0234A Computer and Communication Networks. Socket Programming in C

Socket Programming. CSIS0234A Computer and Communication Networks. Socket Programming in C 1 CSIS0234A Computer and Communication Networks Socket Programming in C References Beej's Guide to Network Programming Official homepage: http://beej.us/guide/bgnet/ Local mirror http://www.cs.hku.hk/~c0234a/bgnet/

More information

PA #2 Reviews. set_name, get_name, del_name. Questions? Will be modified after PA #4 ~

PA #2 Reviews. set_name, get_name, del_name. Questions? Will be modified after PA #4 ~ Sockets Prof. Jin-Soo Kim( jinsookim@skku.edu) TA Dong-Yun Lee(dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu PA #2 Reviews set_name, get_name, del_name Will

More information

Chapter 6. The Transport Layer. Transport Layer 3-1

Chapter 6. The Transport Layer. Transport Layer 3-1 Chapter 6 The Transport Layer Transport Layer 3-1 Transport services and protocols provide logical communication between app processes running on different hosts transport protocols run in end systems

More information

Sockets. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University Embedded Software Lab.

Sockets. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University  Embedded Software Lab. 1 Sockets Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University http://nyx.skku.ac.kr Echo Client (1) 2 #include #include #include #include

More information

Networked Applications: Sockets. End System: Computer on the Net

Networked Applications: Sockets. End System: Computer on the Net Networked Applications: Sockets Topics Programmer s view of the Internet Sockets interface End System: Computer on the Net Internet Also known as a host 2 Page 1 Clients and Servers Client program Running

More information

Εργαστήριο 9 I/O Multiplexing

Εργαστήριο 9 I/O Multiplexing Εργαστήριο 9 I/O Multiplexing Στοεργαστήριοθαμελετηθούν: Server High Level View I/O Multiplexing Solutions for Concurrency nonblocking I/O Use alarm and signal handler to interrupt slow system calls. Use

More information

Sockets Sockets Communication domains

Sockets Sockets Communication domains Sockets Sockets The original method for process communication in UNIX is pipes. A disadvantage with pipes is that they can only be used by processes that have the same parent process. When communicating

More information

Socket Programming for TCP and UDP

Socket Programming for TCP and UDP CSCI4430 Data Communication and Computer Networks Socket Programming for TCP and UDP ZHANG, Mi Jan. 19, 2017 Outline Socket Programming for TCP Introduction What is TCP What is socket TCP socket programming

More information

CSMC 412. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala Set 2. September 15 CMSC417 Set 2 1

CSMC 412. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala Set 2. September 15 CMSC417 Set 2 1 CSMC 412 Computer Networks Prof. Ashok K Agrawala 2015 Ashok Agrawala Set 2 September 15 CMSC417 Set 2 1 Contents Client-server paradigm End systems Clients and servers Sockets Socket abstraction Socket

More information

Lab 0. Yvan Petillot. Networks - Lab 0 1

Lab 0. Yvan Petillot. Networks - Lab 0 1 Lab 0 Yvan Petillot Networks - Lab 0 1 What You Will Do In This Lab. The purpose of this lab is to help you become familiar with the UNIX/LINUX on the lab network. This means being able to do editing,

More information

Project 3. Reliable Data Transfer over UDP. NTU CSIE Computer Networks 2011 Spring

Project 3. Reliable Data Transfer over UDP. NTU CSIE Computer Networks 2011 Spring Project 3 Reliable Data Transfer over UDP NTU CSIE Computer Networks 2011 Spring Project Goal In Project 3, students are asked to understand and implement reliable data transfer mechanism over UDP. UDP

More information

CS321: Computer Networks Introduction to Application Layer

CS321: Computer Networks Introduction to Application Layer CS321: Computer Networks Introduction to Application Layer Dr. Manas Khatua Assistant Professor Dept. of CSE IIT Jodhpur E-mail: manaskhatua@iitj.ac.in Basic Application layer provides services to the

More information

Oral. Total. Dated Sign (2) (5) (3) (2)

Oral. Total. Dated Sign (2) (5) (3) (2) R N Oral Total Dated Sign (2) (5) (3) (2) Assignment Group- A_07 Problem Definition Write a program using TCP socket for wired network for following Say Hello to Each other ( For all students) File transfer

More information

Networked Applications: Sockets. Goals of Todayʼs Lecture. End System: Computer on the ʻNet. Client-server paradigm End systems Clients and servers

Networked Applications: Sockets. Goals of Todayʼs Lecture. End System: Computer on the ʻNet. Client-server paradigm End systems Clients and servers Networked Applications: Sockets CS 375: Computer Networks Spring 2009 Thomas Bressoud 1 Goals of Todayʼs Lecture Client-server paradigm End systems Clients and servers Sockets and Network Programming Socket

More information

A Client-Server Exchange

A Client-Server Exchange Socket programming A Client-Server Exchange A server process and one or more client processes Server manages some resource. Server provides service by manipulating resource for clients. 1. Client sends

More information

CS4514 (C04) HELP Session 1 Introduction to Network Programming (v1.3)

CS4514 (C04) HELP Session 1 Introduction to Network Programming (v1.3) CS4514 (C04) HELP Session 1 Introduction to Network Programming (v1.3) Speaker: Frank Posluszny Outline! Project 1 Overview! Unix Network Programming Client Server Communication with netoracle! Project

More information

Tutorial on Socket Programming

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

More information

CS 3516: Computer Networks

CS 3516: Computer Networks Welcome to CS 3516: Prof. Yanhua Li Time: 9:00am 9:50am M, T, R, and F Location: AK219 Fall 2018 A-term 1 Some slides are originally from the course materials of the textbook Computer Networking: A Top

More information

Piotr Mielecki Ph. D.

Piotr Mielecki Ph. D. Piotr Mielecki Ph. D. http://mielecki.ristel.pl/ piotr.mielecki@pwr.edu.pl pmielecki@gmail.com Building blocks of client-server applications: Client, Server, Middleware. Simple client-server application:

More information

CS4514 B08 HELP Session 1

CS4514 B08 HELP Session 1 CS4514 B08 HELP Session 1 Presented by Choong-Soo Lee clee01@cs.wpi.edu CS4514 TCP/IP Socket Programming Outline Project 1 Overview Unix Network Programming TCP Client TCP Server Processing commands How

More information

Socket Programming. #In the name of Allah. Computer Engineering Department Sharif University of Technology CE443- Computer Networks

Socket Programming. #In the name of Allah. Computer Engineering Department Sharif University of Technology CE443- Computer Networks #In the name of Allah Computer Engineering Department Sharif University of Technology CE443- Computer Networks Socket Programming Acknowledgments: Lecture slides are from Computer networks course thought

More information

Elementary TCP Sockets

Elementary TCP Sockets Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens Distributed Computer Systems 1 socket interface Application 1 Application 2 socket interface user kernel user kernel

More information

Computer Networks Prof. Ashok K. Agrawala

Computer Networks Prof. Ashok K. Agrawala CMSC417 Computer Networks Prof. Ashok K. Agrawala 2018Ashok Agrawala September 6, 2018 Fall 2018 Sept 6, 2018 1 Overview Client-server paradigm End systems Clients and servers Sockets Socket abstraction

More information

CS307 Operating Systems Processes

CS307 Operating Systems Processes CS307 Processes Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2018 Process Concept Process a program in execution An operating system executes a variety of

More information

Processes. Process Concept. The Process. The Process (Cont.) Process Control Block (PCB) Process State

Processes. Process Concept. The Process. The Process (Cont.) Process Control Block (PCB) Process State CS307 Process Concept Process a program in execution Processes An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks All these activities are

More information

NETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science

NETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science NETWORK PROGRAMMING CSC- 341 25 Instructor: Junaid Tariq, Lecturer, Department of Computer Science 26 9 Lecture Sockets as means for inter-process communication (IPC) application layer Client Process Socket

More information

Ά η η 1 (30%): Sockets. socket () bind () listen () accept () connect () read () write () close ()

Ά η η 1 (30%): Sockets. socket () bind () listen () accept () connect () read () write () close () ΗΜΥ 316 - Ε α η ια ή Ά η η 5 Υ ο οίη η Π ω ο ό ο α η αι α α ο ή sockets Ά η η 1 (30%): Sockets π α α α α α π πα π α α ω sockets Unix/Linux. Γ α α α π π α π α Server α Client π π π α έ Α π, α α απ π ω.

More information

Application Programming Interfaces

Application Programming Interfaces Application Programming Interfaces Stefan D. Bruda Winter 2018 SYSTEM CALLS Machine 1 Machine 2 Application 1 Application 3 Application 4 Application 5 Application 2 API (system functions) API (system

More information

CompSci 356: Computer Network Architectures Lecture 3: Hardware and physical links References: Chap 1.4, 1.5 of [PD] Xiaowei Yang

CompSci 356: Computer Network Architectures Lecture 3: Hardware and physical links References: Chap 1.4, 1.5 of [PD] Xiaowei Yang CompSci 356: Computer Network Architectures Lecture 3: Hardware and physical links References: Chap 1.4, 1.5 of [PD] Xiaowei Yang xwy@cs.duke.edu Overview Lab overview Application Programming Interface

More information

Lecture 7. Followup. Review. Communication Interface. Socket Communication. Client-Server Model. Socket Programming January 28, 2005

Lecture 7. Followup. Review. Communication Interface. Socket Communication. Client-Server Model. Socket Programming January 28, 2005 Followup symbolic link (soft link): pathname, can be across file systems, replacement of file will be active on all symbolic links, consumes at least an inode. hard link: pointers to an inode, only in

More information

Department of Computer Science

Department of Computer Science Department of Computer Science Notes on Interprocess Communication in Unix Jean Dollimore,Oct.1990, last revised Feb. 1996 These notes explain how you can write "distributed programs" in C or C++ running

More information

Interprocess Communication Mechanisms

Interprocess Communication Mechanisms Interprocess Communication 1 Interprocess Communication Mechanisms shared storage These mechanisms have already been covered. examples: shared virtual memory shared files processes must agree on a name

More information

Programming with TCP/IP. Ram Dantu

Programming with TCP/IP. Ram Dantu 1 Programming with TCP/IP Ram Dantu 2 Client Server Computing Although the Internet provides a basic communication service, the protocol software cannot initiate contact with, or accept contact from, a

More information

ECE 435 Network Engineering Lecture 2

ECE 435 Network Engineering Lecture 2 ECE 435 Network Engineering Lecture 2 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 6 September 2018 Announcements Homework 1 will be posted. Will be on website, will announce

More information

Processes communicating. Network Communication. Sockets. Addressing processes 4/15/2013

Processes communicating. Network Communication. Sockets. Addressing processes 4/15/2013 Processes communicating Network Communication Process: program running within a host. within same host, two processes communicate using inter-process communication (defined by OS). processes in different

More information

Interprocess Communication Mechanisms

Interprocess Communication Mechanisms Interprocess Communication 1 Interprocess Communication Mechanisms ffl shared storage These mechanisms have already been covered. examples: Λ shared virtual memory Λ shared files processes must agree on

More information

Client-server model The course that gives CMU its Zip! Network programming Nov 27, Using ports to identify services.

Client-server model The course that gives CMU its Zip! Network programming Nov 27, Using ports to identify services. 15-213 The course that gives CMU its Zip! Network programming Nov 27, 2001 Topics Client- model Sockets interface Echo and Client- model Every network application is based on the - model: Application is

More information

Socket Programming. What is a socket? Using sockets. Types (Protocols) Associated functions Styles

Socket Programming. What is a socket? Using sockets. Types (Protocols) Associated functions Styles Socket Programming What is a socket? Using sockets Types (Protocols) Associated functions Styles We will look at using sockets in C Note: Java and C# sockets are conceptually quite similar 1 What is a

More information

Message passing systems are popular because they support client-server interactions, where: clients send messages to servers requesting a server.

Message passing systems are popular because they support client-server interactions, where: clients send messages to servers requesting a server. Client-Server Model Message passing systems are popular because they support client-server interactions, where: clients send messages to servers requesting a server. servers provide services requested

More information

ECE 435 Network Engineering Lecture 2

ECE 435 Network Engineering Lecture 2 ECE 435 Network Engineering Lecture 2 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 31 August 2017 Announcements Homework 1 will be posted. Will be on website, will announce

More information

Introduction to Client-Server Model

Introduction to Client-Server Model Preview Introduction to Client-Server Model Motivation of Client-Server Model Terminologies and Concepts in Client-Server Model Connectionless vs. Connection-Oriented Stateless vs. Stateful Server Identify

More information

How do we Communicate? Introduction to Unix Network Programming. What does Alice do? What does Bob do? Two simplest networking programs

How do we Communicate? Introduction to Unix Network Programming. What does Alice do? What does Bob do? Two simplest networking programs Introduction to Unix Network Programming Reference: Stevens Unix Network Programming How do we Communicate? Send a mail from Alice to Bob Bob Alice in Champaign, Bob in Hollywood Example: US Postal Service

More information

Internet protocol stack. Internetworking II: Network programming. April 20, UDP vs TCP. Berkeley Sockets Interface.

Internet protocol stack. Internetworking II: Network programming. April 20, UDP vs TCP. Berkeley Sockets Interface. 15-213 Internetworking II: Network programming Berkeley sockets interface Internet protocol stack April 20, 2000 Topics client/server model Berkeley sockets TCP client and server examples UDP client and

More information

MSc Integrated Electronics Networks Assignment. Investigation of TCP/IP Sockets and Ports. Gavin Cameron

MSc Integrated Electronics Networks Assignment. Investigation of TCP/IP Sockets and Ports. Gavin Cameron MSc Integrated Electronics Networks Assignment Investigation of TCP/IP Sockets and Ports Gavin Cameron Introduction TCP and IP (Transmission Control Protocol / Internet Protocol) are two protocols from

More information

Internetworking II: Network programming. April 20, 2000

Internetworking II: Network programming. April 20, 2000 15-213 Internetworking II: Network programming Topics April 20, 2000 client/server model Berkeley sockets TCP client and server examples UDP client and server examples I/O multiplexing with select() Internet

More information

CS321: Computer Networks Socket Programming

CS321: Computer Networks Socket Programming CS321: Computer Networks Socket Programming Dr. Manas Khatua Assistant Professor Dept. of CSE IIT Jodhpur E-mail: manaskhatua@iitj.ac.in Socket Programming It shows how the network application programs

More information

ELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition

ELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition ELEC / COMP 177 Fall 2014 Some slides from Kurose and Ross, Computer Networking, 5 th Edition Project #1 Starts in one week Is your Linux environment all ready? Bring your laptop Work time after quick

More information

Introduction to Socket Programming

Introduction to Socket Programming UNIT II - ELEMENTARY TCP SOCKETS Introduction to Socket Programming Introduction to Sockets Socket address Structures Byte ordering functions address conversion functions Elementary TCP Sockets socket,

More information

CSE 43: Computer Networks Structure, Threading, and Blocking. Kevin Webb Swarthmore College September 14, 2017

CSE 43: Computer Networks Structure, Threading, and Blocking. Kevin Webb Swarthmore College September 14, 2017 CSE 43: Computer Networks Structure, Threading, and Blocking Kevin Webb Swarthmore College September 14, 2017 1 Agenda Under-the-hood look at system calls Data buffering and blocking Processes, threads,

More information

Client/Server. Networking Approach.

Client/Server. Networking Approach. Client/Server Networking Approach andrei.doncescu@laas.fr CLIENT/SERVER COMPUTING (THE WAVE OF THE FUTURE) OBJECTIVES Goal: How application programs use protocol software to communicate across networks

More information

CS118 Discussion 1B, Week 1. Taqi Raza BUNCHE 1209B, Fridays 12:00pm to 1:50pm

CS118 Discussion 1B, Week 1. Taqi Raza BUNCHE 1209B, Fridays 12:00pm to 1:50pm CS118 Discussion 1B, Week 1 Taqi Raza BUNCHE 1209B, Fridays 12:00pm to 1:50pm 1 TA Taqi, PhD student in Computer Networking Discussion (1B): Bunche 1209, Fri 12:00 1:50 p.m. Office hours: Boelter Hall

More information

CS 640: Computer Networking

CS 640: Computer Networking CS 640: Computer Networking Yu-Chi Lai Lecture 3 Network Programming Topics Client-server model Sockets interface Socket primitives Example code for echoclient and echoserver Debugging With GDB Programming

More information

Interprocess Communication. Interprocess Communication

Interprocess Communication. Interprocess Communication Interprocess Communication Interprocess Communication The original UNIX systems had pipes as the only interprocess communication method. An improved interprocess communications interface was designed for

More information

Introduction to Socket Programming

Introduction to Socket Programming Introduction to Socket Programming Sandip Chakraborty Department of Computer Science and Engineering, INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR March 21, 2017 Sandip Chakraborty (IIT Kharagpur) CS 39006

More information

Network Socket Programming - 3 BUPT/QMUL

Network Socket Programming - 3 BUPT/QMUL Network Socket Programming - 3 BUPT/QMUL 2018-04-02 Agenda Basic concepts in NP Introduction to IP & TCP/UDP Introduction to Sockets 2 Introduction to Sockets Reviews of some helpful points Sockets interface

More information

Introduction to Socket Programming

Introduction to Socket Programming Introduction to Socket Programming (Advanced Computer Networks) By Priyank Shah NET ID : pss160530 A Simple Question What are Sockets? Sockets are communication points on the same or different computers

More information

Network Socket Programming - 3 BUPT/QMUL

Network Socket Programming - 3 BUPT/QMUL Network Socket Programming - 3 BUPT/QMUL 2017-3-27 Agenda Basic concepts in NP Introduction to IP & TCP/UDP Introduction to Sockets 2 Introduction to Sockets Reviews of some helpful points Sockets interface

More information

CSCE 463/612 Networks and Distributed Processing Spring 2017

CSCE 463/612 Networks and Distributed Processing Spring 2017 CSCE 463/612 Networks and Distributed Processing Spring 2017 Preliminaries II Dmitri Loguinov Texas A&M University January 19, 2017 1 Agenda HTTP basics Windows sockets Clients 2 HTTP Basics General URL

More information

Introduction to Berkeley Sockets

Introduction to Berkeley Sockets INF1060: Introduction to Operating Systems and Data Communication Data Communication: Introduction to Berkeley Sockets Michael Welzl (adapted from lectures by Pål Halvorsen, Carsten Griwodz & Olav Lysne)

More information

Network Communication

Network Communication Network Communication Processes communicating Process: program running within a host. q within same host, two processes communicate using inter- process communica6on (defined by OS). q processes in different

More information

CSC209H Lecture 9. Dan Zingaro. March 11, 2015

CSC209H Lecture 9. Dan Zingaro. March 11, 2015 CSC209H Lecture 9 Dan Zingaro March 11, 2015 Socket Programming (Kerrisk Ch 56, 57, 59) Pipes and signals are only useful for processes communicating on the same machine Sockets are a general interprocess

More information

Review. Preview. Closing a TCP Connection. Closing a TCP Connection. Port Numbers 11/27/2017. Packet Exchange for TCP Connection

Review. Preview. Closing a TCP Connection. Closing a TCP Connection. Port Numbers 11/27/2017. Packet Exchange for TCP Connection Review Preview Algorithms and Issues in Client Software Design Client Architecture Identifying the Location of a Parsing an Address Argument Looking Up a Domain Name Looking Up a Well-Known Port by Name

More information

Network Software Implementations

Network Software Implementations Network Software Implementations Number of computers on the Internet doubling yearly since 1981, nearing 200 million Estimated that more than 600 million people use the Internet Number of bits transmitted

More information

Network Programming in C: The Berkeley Sockets API. Networked Systems 3 Laboratory Sessions

Network Programming in C: The Berkeley Sockets API. Networked Systems 3 Laboratory Sessions Network Programming in C: The Berkeley Sockets API Networked Systems 3 Laboratory Sessions The Berkeley Sockets API Widely used low-level C networking API First introduced in 4.3BSD Unix Now available

More information

1.2 The first Internet (i.e., one of the first packet switched networks) was referred to as the ARPANET.

1.2 The first Internet (i.e., one of the first packet switched networks) was referred to as the ARPANET. CPSC 360 Spring 2011 Exam 1 Solutions This exam is closed book, closed notes, closed laptops. You are allowed to have one 8.5x11 sheets of paper with whatever you like written on the front and back. You

More information

(Refer Slide Time: 1:09)

(Refer Slide Time: 1:09) Computer Networks Prof. S. Ghosh Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecturer # 30 UDP and Client Server Good day, today we will start our discussion

More information

Unix Network Programming

Unix Network Programming Introduction to Computer Networks Polly Huang EE NTU Unix Network Programming The socket struct and data handling System calls Based on Beej's Guide to Network Programming 1 The Unix Socket A file descriptor

More information

Christian Tschudin (basierend auf einem Foliensatz von C. Jelger und T. Meyer) Departement Mathematik und Informatik, Universität Basel

Christian Tschudin (basierend auf einem Foliensatz von C. Jelger und T. Meyer) Departement Mathematik und Informatik, Universität Basel Internettechnologien (CS262) Socket Programming in C 4. März 2015 Christian Tschudin (basierend auf einem Foliensatz von C. Jelger und T. Meyer) Departement Mathematik und Informatik, Universität Basel

More information

Introduction to Lab 2 and Socket Programming. -Vengatanathan Krishnamoorthi

Introduction to Lab 2 and Socket Programming. -Vengatanathan Krishnamoorthi Introduction to Lab 2 and Socket Programming -Vengatanathan Krishnamoorthi Before we start.. Soft deadline for lab 2- February 13 Finish assignment 1 as soon as possible if you have not yet. Hard deadline

More information

Topics for this Week

Topics for this Week Topics for this Week Layered Network Architecture ISO/OSI Reference Model Internet Protocol Suite Overview Application Programming Interface BSD Socket API Readings Sections 1.1-1.5, 6.1.3 (socket programming),

More information

2/13/2014. A protocol is an agreed-upon convention that defines how communication occurs between two (or more?) endpoints

2/13/2014. A protocol is an agreed-upon convention that defines how communication occurs between two (or more?) endpoints Rensselaer Polytechnic Institute CSCI-4220 Network Programming David Goldschmidt, Ph.D. A protocol is an agreed-upon convention that defines how communication occurs between two (or more?) endpoints All

More information

CPSC 213. Introduction to Computer Systems. Inter-Process Communication. Unit 2f

CPSC 213. Introduction to Computer Systems. Inter-Process Communication. Unit 2f CPSC 213 Introduction to Computer Systems Unit 2f Inter-Process Communication 1 Reading For Next Three Lectures Textbook The Client Server Programming Model - Web Servers 2nd ed: 11.1-11.5 1st ed: 12.1-12.5

More information

// socket for establishing connections

// socket for establishing connections #include #include #include #include #include #include #include #define FILELENGTH 511 // This is not right #define

More information

UNIX Sockets. COS 461 Precept 1

UNIX Sockets. COS 461 Precept 1 UNIX Sockets COS 461 Precept 1 Socket and Process Communica;on application layer User Process Socket transport layer (TCP/UDP) OS network stack network layer (IP) link layer (e.g. ethernet) Internet Internet

More information

Group-A Assignment No. 6

Group-A Assignment No. 6 Group-A Assignment No. 6 R N Oral Total Dated Sign (2) (5) (3) (10) Title : File Transfer using TCP Socket Problem Definition: Use Python for Socket Programming to connect two or more PCs to share a text

More information

UNIX Sockets. Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E.

UNIX Sockets. Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E. UNIX Sockets Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E. Socket and Process Communication application layer User Process Socket transport layer (TCP/UDP) network layer (IP)

More information

Network Programming November 3, 2008

Network Programming November 3, 2008 15-213 Network Programming November 3, 2008 Topics Programmer s view of the Internet (review) Sockets interface Writing clients and servers class20.ppt A Client-Server Transaction Most network applications

More information

CompSci 356: Computer Network Architectures. Lecture 3: Network Architecture Examples and Lab 1. Xiaowei Yang

CompSci 356: Computer Network Architectures. Lecture 3: Network Architecture Examples and Lab 1. Xiaowei Yang CompSci 356: Computer Network Architectures Lecture 3: Network Architecture Examples and Lab 1 Xiaowei Yang xwy@cs.duke.edu Overview The Internet Architecture OSI Network Architecture Lab 1 Released Due:

More information

ICT 6544 Distributed Systems Lecture 5

ICT 6544 Distributed Systems Lecture 5 ICT 6544 Distributed Systems Lecture 5 Hossen Asiful Mustafa Message Brokers Figure 4-21. The general organization of a message broker in a message-queuing system. IBM s WebSphere Message-Queuing System

More information

Key Points for the Review

Key Points for the Review Key Points for the Review Network Basics What is internet and Internet? Does WWW equal to Internet? How do machines communicate with one another on the Internet? What are the major components of Internet?

More information

Page 1 of 8 [ Team LiB ] 6.1 The Transport Service In the following sections we will provide an introduction to the transport service. We look at what kind of service is provided to the application layer.

More information

The Berkeley Sockets API. Networked Systems Architecture 3 Lecture 4

The Berkeley Sockets API. Networked Systems Architecture 3 Lecture 4 The Berkeley Sockets API Networked Systems Architecture 3 Lecture 4 The Berkeley Sockets API Widely used low-level C networking API First introduced in 4.3BSD Unix Now available on most platforms: Linux,

More information

Ports under 1024 are often considered special, and usually require special OS privileges to use.

Ports under 1024 are often considered special, and usually require special OS privileges to use. 1 2 Turns out that besides an IP address (used by the IP layer), there is another address that is used by TCP (stream sockets) and, coincidentally, by UDP (datagram sockets). It is the port number. It's

More information

SOCKET PROGRAMMING. What is a socket? Using sockets Types (Protocols) Associated functions Styles

SOCKET PROGRAMMING. What is a socket? Using sockets Types (Protocols) Associated functions Styles LABORATORY SOCKET PROGRAMMING What is a socket? Using sockets Types (Protocols) Associated functions Styles 2 WHAT IS A SOCKET? An interface between application and network The application creates a socket

More information

TCP/IP Sockets in C: Practical Guide for Programmers. Computer Chat. Internet Protocol (IP) IP Address. Transport Protocols. Ports

TCP/IP Sockets in C: Practical Guide for Programmers. Computer Chat. Internet Protocol (IP) IP Address. Transport Protocols. Ports TCP/IP Sockets in C: Practical Guide for Programmers Computer Chat! How do we make computers talk? Michael J. Donahoo Kenneth L. Calvert Morgan Kaufmann Publisher $14.95 Paperback! How are they interconnected?

More information

CSE/EE 461 Lecture 14. Connections. Last Time. This Time. We began on the Transport layer. Focus How do we send information reliably?

CSE/EE 461 Lecture 14. Connections. Last Time. This Time. We began on the Transport layer. Focus How do we send information reliably? CSE/EE 461 Lecture 14 Connections Last Time We began on the Transport layer Focus How do we send information reliably? Topics ARQ and sliding windows Application Presentation Session Transport Network

More information

ECE322 Systems Programming Project 2: Networking with Matrix Multiplication in C Grant Kimes 12/16/15

ECE322 Systems Programming Project 2: Networking with Matrix Multiplication in C Grant Kimes 12/16/15 ECE322 Systems Programming Project 2: Networking with Matrix Multiplication in C Grant Kimes 12/16/15 This project take two inputted matrices of a given size to multiply. The client sends the data to a

More information

Introduction to Berkeley Sockets

Introduction to Berkeley Sockets INF1060: Introduction to Operating Systems and Data Communication Data Communication: Introduction to Berkeley Sockets Michael Welzl (revised by Hans Petter Taugbøl Kragset 2015) (adapted from lectures

More information

Simple network applications using sockets (BSD and WinSock) Revision 1 Copyright Clifford Slocombe

Simple network applications using sockets (BSD and WinSock) Revision 1 Copyright Clifford Slocombe Simple network applications using sockets (BSD and WinSock) Revision 1 Copyright 2002 - Clifford Slocombe sockets@slocombe.clara.net COPYRIGHT 2002 - CLIFFORD SLOCOMBE PAGE 1 OF 8 Table of Contents Introduction...3

More information