Distributed programming
|
|
- Ambrose Shepherd
- 5 years ago
- Views:
Transcription
1 Distributed programming Previously discussed Every SCC is a component in a distributed system that executes distributed programs on a combination of the SCC and one or more other machines. Physically distributed systems concepts Network architecture and the ISO/OSI reference model The device abstraction for communicating: remote computers as devices The client / server architecture
2 What we will learn Computations are based on the idea of a sequential computation. Distributed computations are collections of interacting sequential computations. Sequential computations can be implemented in a physically distributed system Client-server computing makes heavy use of the ISO OSI transport layer to implement datagram (UDP) and connected (TCP) communication across sequential computations running in their own AUCs on distinct machines. Remote procedures as a tool for distributed computing Sequential computations A computer performs useful work by specifying a sequence of instruction that accomplishes some information processing task The instruction sequence is called a sequential computation sequential: instructions are executed one after the other computation: the collection of instruction executions controls the behavior of the computer to accomplish a desired information processing task.
3 Sequential computations Sequential computation rule: the next instruction in the sequence does not start executing until the previous one has completed its execution... int x=2; scanf( %d, &x); printf( f(%d) = %d\n, x, x*x); Sequential computation does not distinguish between I/O instructions and other instructions #define BUF_LEN 100 Example int main() { int infid, outfid; int numread; int i; char buf[buf_len]; if((infid = open("myinput.txt", O_RDONLY)) == -1) { fprintf(stderr, "usage: open() failed, halting\n"); exit(-1); if((outfid = open("myoutput.txt", O_CREAT O_WRONLY)) == -1) { fprintf(stderr, "usage: open() failed, halting\n"); exit(-1); /* Input & output files are ready to use */ while((numread = read(infid, buf, BUF_LEN))!= 0) // Read MyInput write(outfid, buf, numread); // Copy to MyOutput /* File copy complete */ close(infid); close(outfid); exit(0);
4 Sequential computations: AUC Autonomous Unit of Computation (AUC): generic abstract machine that executes a sequential computation Abstract machine: a simulation of a physical machine Examples: coroutines, threads, lightweight processes, heavyweight processes, tasks Sequential computations: AUC Realization example: multiprogramming OS
5 Distributed computations A distributed computation is a set of cooperating sequential computations. Created by defining a collection of sequential computations executing in AUCs that coordinate their efforts by exchanging information Distributed computations extend sequential computation & AUCs by adding means for intercommunication mechanisms among the relevant AUCs Distributed computations Sequential computation rule: the computation is determinate: each execution of the program (on the same input data) produces the same output. SCR violated: the program can still be made to be determinate, if the programmer used some other mechanism to assure determinacy. Distributed programming is the art of writing programs that will be executed on a distributed system, generally as determinate programs.
6 Example: sequential computations... startread(dev_3, x); while(dev_3.busy == 1) (wait); // The device is done y = f(x);... CPU while(dev_3.busy == 0) (wait); DEV_3.busy = 1; // Perform an input op return(value); DEV3.busy = 0 Sequential operation DEV_3 Hardware Example: distributed computations... startread(dev_3, x); while(dev_3.busy == 1) executecodefragment(); // The device is done y = f(x);... CPU while(dev_3.busy == 0) (wait); DEV_3.busy = 1; // Perform an input op return(value); DEV3.busy = 0 Overlapped operation DEV_3 Hardware
7 Distributed computations General idea: partition the work of an algorithm into subalgorithms, Each subalgorithm can be executed relatively independent: A subalgorithm can be implemented by a small sequential computation Each subalgorithm is assigned its own AUC when it is executed by the OS. Distributed computations Difficulties: defining subalgorithms that can execute relatively independently from one another, yet contribute to the solution of the general algorithm ensuring that in the few cases where the subalgorithms interact with one another to coordinate their execution, that they do so in such a way that the logical pattern of sequential execution of the general algorithm is preserved.
8 The Client / Server model Using the Network for Distributed Computations Application Presentation Session Transport Network Data Link Physical Application Presentation Session Transport Network Data Link Physical implemented in the OS implemented in the network device controller (NIC ) We will discuss how to write programs that uses ISO OSI compliant networks
9 ISO OSI Model Transport Network Data Link Physical Transport Network Data Link Physical Dominant Transport layer net: TCP-based network ISO OSI & TCP/IP ISO OSI Session ISO OSI packet ISO OSI TLI ISO OSI frame ISO OSI Network ISO OSI Session ISO OSI packet ARPAnet TCP IP frame ARPAnet IP Ethernet packet MAC Ethernet
10 Client/Server via TCP/IP Client AUC Server AUC Socket layer Socket layer ARPAnet TCP IP frame ARPAnet IP Ethernet packet Ethernet driver ARPAnet TCP IP frame ARPAnet IP Ethernet packet Ethernet driver Transport Layer Provides yet another address extension IP references only networks and hosts Transport layer adds ports -- logical endpoints Address form is <net, host, port> Two primary protocols (both from ARPAnet) Transmission Control Protocol (TCP) User Datagram Protocol (UDP)
11 DNS Transport Layer Transmission Control Protocol (TCP) Telephone call (connection) Provides a stream-oriented interface to the network Reliable delivery but more overhead Higher level transactions User Datagram Protocol (UDP) Telegram User-space interface to IP packets No guarantee that packet will be delivered, but less data MPEG transmission (connectionless) Programming the Transport Layer The network layer identifies senders and receivers in terms of a <net, host> pair The transport layer address space is extended beyond internet addresses so that transmitter can reference a specific port on a remote host on a remote network mumble.cs.colorado.edu ports port numbers Host: 34 Net: P P P P Transport Layer Network Layer Low Layers n
12 DNS DNS Programming the Transport Layer Each machine can support a number of ports to represent places for information to be sent and received from/to software in the machine ports are OS resources: an AUC must obtain the right to use a particular port either by dynamically requesting the port, or by having the port permanently reserved mumble.cs.colorado.edu ports port numbers Host: 34 Net: P P P P Transport Layer Network Layer Low Layers n Programming the Transport Layer A BSD socket is an OS data structure that can be dynamically associated with a port. The socket is designed so that a sequential computation can configure it to connect to the port, and then to transmit and receive information using a variety of transport layer protocols, including TCP and UDP. mumble.cs.colorado.edu ports Host: 34 Net: P P P P Transport Layer Network Layer Low Layers
13 Socket-programming using TCP Socket: a door between application process and end-endtransport protocol (UDP or TCP) TCP service: reliable transfer of bytes from one process to another controlled by application developer controlled by operating system process socket TCP with buffers, variables internet process socket TCP with buffers, variables controlled by application developer controlled by operating system host or server host or server Socket-programming using TCP Connected (or virtual circuit) protocol: full duplex byte stream channel Interface allows programmer to read/write a byte stream over the network Byte stream is mapped into a series of packets Reliable delivery Each packet must be acknowledged Effectively 2 packets per transmission Must open/close a connection before use
14 Socket-programming using TCP Byte stream I/O: enables a sequential computation to write an arbitrary collection of bytes to the stream, and for another sequential computation to simply read the collection of bytes. POSIX system call interface: includes the functions read() and write() to receive and transmit bytes on a byte stream virtual device The device : a physical device, a file, a pipe, or another abstraction of an I/O device. Socket-programming using TCP Client must contact server server process must first be running server must have created socket (door) that welcomes client s contact Client contacts server by: creating client-local TCP socket when client creates socket: client TCP establishes connection to server TCP specifying IP address, port number of server process When contacted by client, server TCP creates new socket for server process to communicate with client allows server to talk with multiple clients 28
15 Client/server socket interaction: TCP Server (running on hostid) create socket skt = socket() what port am I on? bind() will somebody please call me? listen() Client create socket, clientsocket = socket() Thanks for calling port XXX connectskt = accept() read request from connectskt TCP connection setup Hey, you! connect() send request using clientsocket write reply to connectskt close connectskt read reply from connectskt close clientsocket 29 Socket data structures Structures are used in socket programming to hold information about the address struct sockaddr{ unsigned short sa_family; /* address family, AF_xxx */ char! sa_data[14]; /* 14 bytes of protocol address */ ; struct sockaddr_in { short int! sin_family; /* Address family */ unsigned short int sin_port;! /* Port */ struct in_addr! sin_addr;! /* Internet Address */ unsigned char! sin_zero[8]; /* not used */ ; struct in_addr{ unsigned long s_addr; /* address */ ;
16 Creating the socket A BSD socket is an OS data structure that can be dynamically associated with a port: socket int socket(int domain, int sockettype, int protocolno) handle = "AF_INET" to use ARPA For Stream Socket the type must be 0 = default index into an internal table internet protocols or SOCK_STREAM of socket descriptions "AF_UNIX" to create For Datagram Socket the type must sockets for inside be SOCK_DGRAM comunication S P P P P Transport Layer Network Layer Low Layers What port am I on? Once a socket has been created, it can be bound to an internet port int bind(int sktid, struct sockadrr *addr, int addrlength) socket handle specifies the <<net, host> port> length of the addr field S P P P P Transport Layer Network Layer Low Layers
17 Will somebody please call me? int listen(sktid, socket descriptor returned by socket() call int backlog) the number of allowed connections: the maximum queue length waiting for incoming connections if you want someone to connect to your machine. when a server arranges to accept connections over a virtual circuit, the kernel must queue incoming requests until it can service them Before calling listen(), you must call bind() or you'll be listening on a random port Hey you! connect() is used to connect to an IP address on a defined port. int connect(sktid, struct sockaddr *serv_addr, int addrlen); socket handle Address of the TARGET socket: pointer to struct sockaddr that contains destination IP address and port sizeof(struct sockaddr) when connect() returns, the client has a virtual circuit to the server. Returns -1 on error.
18 Thanks for calling port XXX! When someone is trying to connect, you must use accept() to get the connection. NEW socket handle int accept(int sktid, void *addr, int *addrlen); socket handle pointer to struct sockaddr_in where you can determine which host is calling you from which port sizeof(struct sockaddr) usage example: sin_size=sizeof(struct sockaddr_in); if ((new_sktid = accept(sktid,(struct sockaddr *) &client,&sin_size))==-1)! printf("accept() error\n");! exit(-1); new_ sktid will be used for communication Using TCP -- Client (Unix domain) #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_DIM 256 #define Error_(x) { puts(x); exit (1); int main() {! int ds_sock, res;! struct sockaddr indirizzoserver;! char buff[max_dim], nomesocket[20];! printf("\ninserisci nome socket -> "); scanf("%s",nomesocket);! strcpy(indirizzoserver.sa_data, nomesocket);! ds_sock = socket(af_unix, SOCK_STREAM, 0);! printf("client: Mi connetto al socket...\n");! res = connect(ds_sock, &indirizzoserver, sizeof(indirizzoserver));! if (res == -1) Error_("CLIENT: Errore nella connessione\n");! printf("client: Trasmetto messaggio...\n");! write(ds_sock,"ciao ciao dal Client!", MAX_DIM);! read(ds_sock, buff, MAX_DIM);! printf("client: Ho letto %s", buff);! close(ds_sock);! exit(0);
19 Using TCP -- Server (Unix domain) #define MAX_DIM 256 #define Error_(x) { perror(x); exit (1); int main() {! int ds_sock, new_sock, res;! struct sockaddr indirizzoserver, indirizzoclient;! int client_lgth;! char buff[max_dim], nomesocket[20];!! printf("\ninserisci nome socket -> "); scanf("%s",nomesocket);!! strcpy(indirizzoserver.sa_data,nomesocket);! ds_sock = socket(af_unix, SOCK_STREAM, 0);! if (ds_sock == -1) Error_("SERVER: Non creo la socket");! if ((bind(ds_sock, &indirizzoserver, sizeof(indirizzoserver))) == -1) Error_("SERVER: Errore nella bind");!! listen(ds_sock, 1);! printf("server: Socket pronta! Attendo connessioni...\n"); fflush(stdout);!!! new_sock= accept(ds_sock, &indirizzoclient, &client_lgth);! printf("server: Ho accettato una connessione\n");! close(ds_sock);!!!! read(new_sock, buff, MAX_DIM);! printf("server: Ho letto %s", buff);! fflush(stdout);!!! write(new_sock, "SERVER: messaggio ricevuto!\n",30 );! close(new_sock);! exit(0);! Using TCP -- Server (Internet domain) #include <sys/types.h> #include <sys/socket.h> #include <sys/signal.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> #include <stdlib.h> #define MAX_DIM 1024 #define Error_(x) { perror(x); exit (1); int main() {! int ds_sock, new_sock, res;! struct sockaddr_in client, server;! unsigned int client_lgth;!! char buff[max_dim];!! ds_sock = socket(af_inet, SOCK_STREAM, 0);! if (ds_sock == -1) Error_("\nSERVER: Non creo la socket");!! server.sin_family = AF_INET;! server.sin_port = 2000;! server.sin_addr.s_addr = INADDR_ANY; //non specifica l'ip address!!! if ((bind(ds_sock, (struct sockaddr*)&server, sizeof(server))) == -1) Error_("\nSERVER: Errore nella bind");! listen(ds_sock, 3);! printf("\nserver: Socket pronta! Attendo connessioni...\n");fflush(stdout);! client_lgth = sizeof(client);!!!! new_sock = accept(ds_sock, (struct sockaddr*)&client, &client_lgth);! printf("\nserver: Ho accettato una connessione\n");!!! do {!!! read(new_sock, buff, MAX_DIM);!!! printf("%s ", buff); fflush(stdout);!!!! while ( strcmp(buff, "quit")!= 0 );! write(new_sock, "\n ricevuto tutto!\n", 30);! close(ds_sock);! close(new_sock);! exit(0);!
20 Using TCP -- Client (Internet domain) #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> #include <stdlib.h> #include <strings.h> #define MAX_DIM 1024 #define Error_(x) { puts(x); exit (1); int main() {! int ds_sock, res;! struct sockaddr_in client;! struct hostent *phost;! char buff[max_dim];! ds_sock = socket(af_inet, SOCK_STREAM, 0);! client.sin_family = AF_INET;! client.sin_port = 2000;! //recupera info relativa all'host! phost = gethostbyname("macbook-di-giuseppe-boccignone.local");! //phost->h_addr: contiene l'indirizzo dell'host phost->h_length: lunghezza in byte dell'indirizzo! bcopy(phost->h_addr, &client.sin_addr, phost->h_length);! res = connect(ds_sock, (struct sockaddr*)&client, sizeof(client));! if (res == -1) Error_("CLIENT: Errore nella connessione\n");! printf("client: Digitare le stringhe: ");! do {!! scanf("%s", buff);!! write(ds_sock, buff, MAX_DIM);! while ( strcmp(buff, "quit")!= 0 );! read(ds_sock, buff, MAX_DIM);! printf("client: IL server risponde: %s\n", buff);! close(ds_sock); UDP Datagram ( connectionless ) service Similar to disk I/O level of service Logically associated with an IP packet & Data Link frame (but not physically) Best-effort delivery of datagrams, but: Datagram may be dropped (lost) Datagrams may be delivered out of order Efficient, relative to TCP
21 TCP Readers and writers TCP Readers and writers
22 TCP: the writer Server... skt = socket(af_inet, SOCK_STREAM, 0); /* Build the writer's address */... /* The socket has to be bound to an IP address to get data sent to IP */ if(bind(skt, (struct sockaddr *) &writer, sizeof(writer))) { fprintf(stderr, "Bind error, restart...\n"); exit(1); /* Set up the socket to listen for connect requests */ listen(skt, MAX_REQUESTS); newskt = accept(skt, (struct sockaddr *) &writer, &addrlen); close(skt); // Close the listener socket, skt, use the newskt /* Run the writer part of the distributed computation */ /* Open the destination file */... while((numrcvd = read(newskt, buf, BUF_LEN)) > 0) { write(outfid, buf, numrcvd); /* Clean up and quit */ printf("writer: terminating...\n"); exit(0); Using TCP: the Reader Client /* Set up a socket to talk to the writer */ skt = socket(af_inet, SOCK_STREAM, 0); /* Build the writer's address */... /* Open the connection to writer */ if(connect(skt, (struct sockaddr *) &writer, sizeof(writer)) < 0) { fprintf(stderr, "reader: connect() failed, halting\n"); exit(1); /* Run the reader part of the distributed computation */ /* Open the source file */... /* Here is the main reader loop */ while((numread = read(infid, buf, BUF_LEN)) > 0) { write(skt, buf, numread); /* trasmitting */ /* Clean up and quit */ printf("reader: Terminating...\n"); exit(0);
23 The smart thermometer The smart thermometer... /* The Control Path is data flowing from the large computer to the * SCC via the TCP connection. Thermometer data flows * from the SCC to the large computer over the same TCP * connection. */ skt = socket( ); read(skt, high_threshold_value); // SCC reads control info from host read(skt, low_threshold_value); // SCC reads control info from host while( ) { read(thermometer, value); if(value > high_threshold_value){ write(skt, value); // Write data to the host computer continue; if(value < low_threshold_value){ write(skt, value); // Write data to the host computer continue;
24 Remote Procedure Call (RPC) Summary Computations are based on the idea of a sequential computation. Distributed computations are collections of interacting sequential computations. Sequential computations can be implemented in a physically distributed system Client-server computing makes heavy use of the ISO OSI transport layer to implement datagram (UDP) and connected (TCP) communication across sequential computations running in their own AUCs on distinct machines. RPC allows an SCC to invoke compute intensive and data intensive services that are implemented on a large networkaccessible machine without special concern about determinacy and adherence to the sequential computation rule.
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 informationSockets. 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 informationLab 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 informationHyo-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 informationPA #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 informationSocket 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 informationUnix 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 informationMSc 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 informationProgramming 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 informationSystem Programming. Sockets
Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Introducing 2 3 Internet
More informationTutorial 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 informationOral. 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 informationCSC209H 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 informationProcesses 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 informationsottotitolo Socket Programming Milano, XX mese 20XX A.A. 2016/17 Federico Reghenzani
Titolo presentazione Piattaforme Software per la Rete sottotitolo Socket Programming Milano, XX mese 20XX A.A. 2016/17 Outline 1) Introduction to Sockets 2) UDP communication 3) TCP communication 4) RAW
More informationSocket Programming TCP UDP
Socket Programming TCP UDP Introduction Computer Network hosts, routers, communication channels Hosts run applications Routers forward information Packets: sequence of bytes contain control information
More informationSocket 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 informationContext. Distributed Systems: Sockets Programming. Alberto Bosio, Associate Professor UM Microelectronic Departement
Distributed Systems: Sockets Programming Alberto Bosio, Associate Professor UM Microelectronic Departement bosio@lirmm.fr Context Computer Network hosts, routers, communication channels Hosts run applications
More informationCSE 124 Discussion Section Sockets Programming 10/10/17
CSE 124 Discussion Section Sockets Programming 10/10/17 Topics What s a socket? Creating a socket Connecting a socket Sending data Receiving data Resolving URLs to IPs Advanced socket options Live code
More informationThe 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 informationLecture 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 informationNetwork 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 informationSession NM056. Programming TCP/IP with Sockets. Geoff Bryant Process software
Session NM056 Programming TCP/IP with Sockets Geoff Bryant Process software Course Roadmap Slide 57 NM055 (11:00-12:00) Important Terms and Concepts TCP/IP and Client/Server Model Sockets and TLI Client/Server
More informationChapter 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 informationCSE 333 SECTION 7. C++ Virtual Functions and Client-Side Network Programming
CSE 333 SECTION 7 C++ Virtual Functions and Client-Side Network Programming Overview Virtual functions summary and worksheet Domain Name Service (DNS) Client side network programming steps and calls dig
More informationDepartment 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 informationNetwork 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 informationPorts 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 informationUNIT 1 TCP/IP PROGRAMMING CONCEPTS
UNIT 1 TCP/IP PROGRAMMING CONCEPTS TCP/IP Programming Concepts Structure Page Nos. 1.0 Introduction 5 1.1 Objectives 5 1.2 Client Server Communication 6 1.2.1 Designing Client/Server Programs 7 1.2.2 Socket
More informationNetwork Programming in C. Networked Systems 3 Laboratory Sessions and Problem Sets
Network Programming in C Networked Systems 3 Laboratory Sessions and Problem Sets Lab Timetable, Aims, and Objectives Teaching Week Activity 14 Introduction 15 Warm-up exercise 16 17 Web client 18 19 20
More informationSockets. 1 Introduction. (Reference:, Gray Chapter 10) Network Programming Lecture Notes by. Turhan TUNALI
Sockets (Reference:, Gray Chapter 10) Network Programming Lecture Notes by 1 Introduction Turhan TUNALI Unix uses a common interface for the access of files and devices that reside on a single host. The
More informationCLIENT-SIDE PROGRAMMING
CLIENT-SIDE PROGRAMMING George Porter Apr 11, 2018 ATTRIBUTION These slides are released under an Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Creative Commons license These slides
More informationCS 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 informationCS 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 informationChapter 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 informationA 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 informationOutline. Distributed Computer Systems. Socket Basics An end-point for a IP network connection. Ports. Sockets and the OS. Transport Layer.
Outline Distributed Computer Systems Socket basics Socket details (TCP and UDP) Socket options Final notes Sockets Socket Basics An end-point for a IP network connection what the application layer plugs
More informationTCP: Three-way handshake
Sockets in C 1 Sockets in C The slides by themselves will not be sufficient to learn how to write socket code. If you did not attend class, then you will want to review the relevant chapters in Kerrisk
More informationSockets 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 informationCS118 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 informationCSE 333 SECTION 8. Sockets, Network Programming
CSE 333 SECTION 8 Sockets, Network Programming Overview Domain Name Service (DNS) Client side network programming steps and calls Server side network programming steps and calls dig and ncat tools Network
More informationSocket Programming. Dr. -Ing. Abdalkarim Awad. Informatik 7 Rechnernetze und Kommunikationssysteme
Socket Programming Dr. -Ing. Abdalkarim Awad Informatik 7 Rechnernetze und Kommunikationssysteme Before we start Can you find the ip address of an interface? Can you find the mac address of an interface?
More informationCompSci 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 informationECE 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 informationSockets. 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 informationCS307 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 informationProcesses. 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 informationNETWORK 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 informationOutline. Operating Systems. Socket Basics An end-point for a IP network connection. Ports. Network Communication. Sockets and the OS
Outline Operating Systems Socket basics Socket details Socket options Final notes Project 3 Sockets Socket Basics An end-point for a IP network connection what the application layer plugs into programmer
More informationNetworks. Practical Investigation of TCP/IP Ports and Sockets. Gavin Cameron
Networks Practical Investigation of TCP/IP Ports and Sockets Gavin Cameron MSc/PGD Networks and Data Communication May 9, 1999 TABLE OF CONTENTS TABLE OF CONTENTS.........................................................
More informationECE 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 informationCSE 333 Lecture 16 - network programming intro
CSE 333 Lecture 16 - network programming intro Hal Perkins Department of Computer Science & Engineering University of Washington Today Network programming - dive into the Berkeley / POSIX sockets API -
More informationIntroduction 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 informationCSE 333 SECTION 7. Client-Side Network Programming
CSE 333 SECTION 7 Client-Side Network Programming Overview Domain Name Service (DNS) Client side network programming steps and calls dig and ncat tools Network programming for the client side Recall the
More informationIntroduction 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 informationWinSock. What Is Sockets What Is Windows Sockets What Are Its Benefits Architecture of Windows Sockets Network Application Mechanics
WinSock What Is Sockets What Is Windows Sockets What Are Its Benefits Architecture of Windows Sockets Network Application Mechanics What Is Sockets Standard API (Application Programming Interface) for
More informationOverview. Administrative. * HW# 5 Due next week. * HW# 5 : Any Questions. Topics. * Client Server Communication. * 12.
Overview Administrative * HW# 5 Due next week * HW# 5 : Any Questions Topics * Client Server Communication * 12.3 ISO/OSI Layers * 12.4 UICI Implementations * App. B (UICI : Socket Implementation) * 12.4
More informationIntroduction 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 informationReview. 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 informationOutline. Distributed Computing Systems. Socket Basics (1 of 2) Socket Basics (2 of 2) 3/28/2014
Outline Distributed Computing Systems Sockets Socket basics Socket details (TCP and UDP) Socket options Final notes Socket Basics (1 of 2) An end-point for an Internet network connection what application
More informationNetwork Programming Worksheet 2. Simple TCP Clients and Servers on *nix with C.
Simple TCP Clients and Servers on *nix with C. Aims. This worksheet introduces a simple client and a simple server to experiment with a daytime service. It shows how telnet can be used to test the server.
More informationNetwork programming(i) Lenuta Alboaie
Network programming(i) Lenuta Alboaie adria@info.uaic.ro 2017 2018 Computer Network http://www.info.uaic.ro/~computernetworks 1 Content Client/server paradigm API for network programming BSD Socket Characteristics
More informationTypes (Protocols) Associated functions Styles We will look at using sockets in C Java sockets are conceptually quite similar
Socket Programming What is a socket? Using sockets Types (Protocols) Associated functions Styles We will look at using sockets in C Java sockets are conceptually quite similar - Advanced Data Communications:
More informationApplication Programming Interfaces
Application Programming Interfaces The TCP/IP protocol suite provides only the protocols that can be used by processes to communicate across a network. Though standarized, how these protocols are implemented
More informationHow 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 informationApplication 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 informationCommunication. Sockets (Haviland Ch. 10)
Communication Sockets (Haviland Ch. 10) 1 Simple Web Request 5LFKDUG V+RPH3DJH &RXUVHV 5HVHDUFK 2 How do we find the server? Every computer on the Internet has an Internet address. Called an IP address
More informationCSc 450/550 Computer Networks Network Architectures & Client-Server Model
CSc 450/550 Computer Networks Network Architectures & Client-Server Model Jianping Pan Summer 2007 5/17/07 CSc 450/550 1 Last lectures So far, nuts and bolts views of the Internet Internet evolution and
More informationComputer Network Lab, SS Fachgebiet Technische Informatik, Joachim Zumbrägel. Overview. Sockets. Sockets in C.
Computer Network Lab 2016 Fachgebiet Technische Informatik, Joachim Zumbrägel Overview Sockets Sockets in C Sockets in Delphi 1 Inter process communication There are two possibilities when two processes
More informationCompSci 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 informationCS4514 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 informationUNIX 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 informationCSE/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 informationCommunication. Communication. Distributed Systems. Networks and protocols Sockets Remote Invocation Messages Streams. Fall /10/2001 DoCS
Communication Distributed Systems Fall 2002 Communication Process Process Networks and protocols Sockets Remote Invocation Messages Streams 9/10/2001 DoCS 2002 2 Layered Protocols (1) Layers, interfaces,
More informationCSE 333 Section 8 - Client-Side Networking
CSE 333 Section 8 - Client-Side Networking Welcome back to section! We re glad that you re here :) Networking Quick Review What are the following protocols used for? (bonus: what layer of the networking
More informationWhat s an API? Do we need standardization?
Network Interface z The network protocol stack is a part of the OS z Need an API to interface applications to the protocol stack. What s an API? Do we need standardization? z The socket interface is the
More informationPiotr 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 informationThe TCP Protocol Stack
The TCP Protocol Stack Michael Brockway February 16, 2018 Introduction - Layered archtecture Networking software is desgined in a layered fashion The bottom layer is the services offered by the underlying
More informationSockets 15H2. Inshik Song
Sockets 15H2 Inshik Song Internet CAU www server (www.cau.ac.kr) Your web browser (Internet Explorer/Safari) Sockets 2 How do we find the server? Every computer on the Internet has an Internet address.
More informationInterprocess 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 informationThe 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 informationICT 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 informationUNIX Network Programming. Overview of Socket API Network Programming Basics
UNIX Network Programming Overview of Socket API Network Programming Basics 1 Client-Server Model Client Machine A Network Server Machine B Web browser and server FTP client and server Telnet client and
More informationNetwork 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 informationSystems software design NETWORK COMMUNICATIONS & RPC SYSTEMS
Systems software design NETWORK COMMUNICATIONS & RPC SYSTEMS outline network programming BSD/POSIX Socket API RPC systems object-oriented bridges CORBA DCOM RMI WebServices WSDL/SOAP XML-RPC REST network
More informationLecture 3 Overview! Last Lecture! TCP/UDP and Sockets introduction!
Lecture 3 Overview! Last Lecture! TCP/UDP and Sockets introduction! This Lecture! Elementary TCP sockets! TCP Client-Server example! Source: Stevens book(chapters 4,5), Comer s book (Chapters 20, 21)!
More informationCS321: 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 informationCSE 333 Lecture network programming intro
CSE 333 Lecture 17 -- network programming intro Hal Perkins Paul G. Allen School of Computer Science & Engineering University of Washington Administrivia HW3 due Thursday night HW4 out Friday morning -
More informationNetwork Socket Programming - 2 BUPT/QMUL
Network Socket Programming - 2 BUPT/QMUL 2017-3-20 Review Basic Concepts in NP Introduction to Network Programming Importance Classes Environments in this course Program Developing Phases Skills Useful
More informationClient Server Computing
Client Server Computing Although the Internet provides a basic communication service, the protocol software cannot initiate contact with, or accept contact from, a remote computer. Instead, two application
More informationCS4700/CS5700 Fundamentals of Computer Networking
CS4700/CS5700 Fundamentals of Computer Networking Prof. Alan Mislove Lecture 3: Crash course in socket programming September 10th, 2009 Project 0 Goal: Familiarize you with socket programming in C Implement
More informationCSE 333 Lecture 8 - file and network I/O
CSE 333 Lecture 8 - file and network I/O Steve Gribble Department of Computer Science & Engineering University of Washington CSE333 lec 8 net // 04-13-12 // gribble Administrivia HW1 was due yesterday
More informationInterprocess 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 informationElementary 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 informationThe Socket Interface. Socket and Socket Library
The Socket Interface Client and server use the transport protocol to communicate. When it interacts with protocol, an application must specify :whether it is a server or a client (that is, wether it will
More informationSocket Programming 2007/03/28
Socket Programming 2007/03/28 Reference W. Richard Stevens, Unix Network Programming 2/e Volume 1,1998 James F. Kurose and Keith W. Ross, "Computer Networks: A Top-Down Approach Featuring the Internet
More informationCSE 333 SECTION 6. Networking and sockets
CSE 333 SECTION 6 Networking and sockets Overview Network Sockets IP addresses and IP address structures in C/C++ DNS Resolving DNS names Demos Section exercise Sockets Network sockets are network interfaces
More informationCS321: 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 informationGroup-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 informationNetwork 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