VP Verteilte Informationssysteme Message Based Communication Socket Basics

Size: px
Start display at page:

Download "VP Verteilte Informationssysteme Message Based Communication Socket Basics"

Transcription

1 VP Verteilte Informationssysteme Message Based Communication Socket Basics Hilmar Linder Hilmar Linder 1

2 Contents Message Oriented Communication The Client-Server Model Berkeley Socket API Address structures Socket functions Client-Server communication using UDP and TCP Java Socket API (old API) References 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 2 Hilmar Linder 2

3 Synchronous vs. Asynchronous Communication Synchronous: client sends request and waits for the reply (blocking) Client cannot do other works Failures need to be handled immediately Not appropriate for Mail, News Asynchronous: client sends request and continues with other processing while waiting for the reply (non-blocking). Replies are queued. Client periodically checks queues Callbacks 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 3 Hilmar Linder 3

4 Persistent versus Transient Communication Persistent communication: A message is stored at a communication server as long as it takes to deliver it at the receiver Transient communication: A message is discarded by a communication server as soon as it cannot be delivered at the next server, or at the receiver 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 4 Hilmar Linder 4

5 Persistence and Synchronicity in Communication a) Persistent asynchronous communication (e.g. ) b) Persistent synchronous communication 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 5 Hilmar Linder 5

6 Persistence and Synchronicity in Communication c) Transient asynchronous communication (e.g. UDP) d) Receipt-based transient synchronous communication 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 6 Hilmar Linder 6

7 Persistence and Synchronicity in Communication e) Delivery-based transient synchronous communication at message delivery f) Response-based transient synchronous communication (e.g. RPC) 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 7 Hilmar Linder 7

8 Message Oriented Communication Types Message Oriented Transient Communication Berkeley Sockets (comes next) The Message Passing Interface (not considered) Message Oriented Persistent Communication Message Systems (Message Oriented Middleware) 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 8 Hilmar Linder 8

9 Process Organization in Distributed Systems How to organize the processes in a distributed system? Client-Server Model (C+S) Peer to Peer Model 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 9 Hilmar Linder 9

10 Semantic of C + S Interaction A local interaction should have the same syntax and semantic as remote interaction, but remote interaction may suffer from transmission errors Request is lost Reply is lost Server or Client crashes Different Semantic Models may be: no guarantees at all at least once: client uses timeouts and repeats requests at most once: requests have sequence numbers exactly once: persistent storage for requests 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 10 Hilmar Linder 10

11 Example: C + S Interaction 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 11 Hilmar Linder 11

12 Advanced C + S Models Disadvantages of C + S Systems: Single point of failure Single point of processing Solution: make a multiple server system look like a single server system (coordination btw. servers needed). Possible C + SS + Models: Proxy Broker Trader Balancer Agent 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 12 Hilmar Linder 12

13 Proxy Server Proxy forwards the request to the server Can be combined with local caching Security 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 13 Hilmar Linder 13

14 Broker Clients do not need to know the servers, they contact the broker who is in charge of all servers Servers register their services with the broker Broker implementations: Forwarding, handle-driven, or hybrid Broker 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 14 Hilmar Linder 14

15 Trader Trader chooses server according to a given QoS Server must be able to deliver QoS selected 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 15 Hilmar Linder 15

16 Balancer Balancer assigns requests to the replicated servers based on their current processing load 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 16 Hilmar Linder 16

17 Agent For clients that want to access multiple services with one request Agents perform the individual requests and sends a single cumulative reply 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 17 Hilmar Linder 17

18 Application Layering Problem: draw a clear distinction between client and server?! For C+S applications targeted to access databases: User interface level Processing level Data level 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 18 Hilmar Linder 18

19 C + S Architectures (1) Motivation: physically distribute the logical layers of a C+S system across several machines Example: two-tired architecture 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 19 Hilmar Linder 19

20 C + S Architectures (2) A) Null Client: client submits individual key strokes or mouse movements B) Thin Client: client processes the GUI and state information C) Applet Client: client GUI includes some parts of the application logic D and E) Fat Client: the client contains the whole application logic except the database backend 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 20 Hilmar Linder 20

21 C + S Architectures (3) Three-Tired Architecture Layer 1: Clients (Presentation layer) Layer 2: Application and Processing Servers Layer 3: Persistent Storage Servers 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 21 Hilmar Linder 21

22 Alternative Architectures Multi-tiered architectures seem to constitute buzzwords that fail to capture many modern C+S organizations (vertical distribution) Cooperating servers: Service is physically distributed across a collection of servers: Network news services Workflow systems Financial brokerage systems Cooperating clients: Distributed application exists by virtue of client collaboration: Teleconferencing systems Publish/subscribe architectures 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 22 Hilmar Linder 22

23 Message Oriented Transient Communication Hilmar Linder 23

24 Network Application Programming Interface (API) The services provided by the operating system that provide the interface between application and protocol software Note: the network API is a transport layer interface Application Network API Protocol A Protocol B Protocol C 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 24 Hilmar Linder 24

25 Network APIs for TCP/IP TCP/IP does not include an API definition. There are a variety of APIs for use with TCP/IP: Berkeley Sockets Winsock, Winsock/2 TLI (is an implementation of the OSI Transport Layer Interface), 1986, System V XTI X/Open Transport Interface, modified version of TLI, 1988 Streams 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 25 Hilmar Linder 25

26 Berkeley Sockets Networking protocols are implemented as part of the NOS The networking API exported by most NOS s is the socket interface Originally provided by BSD 4.2 ~1983 The principal abstraction is a socket Point at which an application attaches to the network Sockets work with Unix I/O services just like files, pipes and FIFOs Sockets (obviously) have special needs: establishing a connection specifying communication endpoint addresses 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 26 Hilmar Linder 26

27 Addresses and Names Internet domain names Human readable textual representation Variable length Example: IP addresses Easier to handle by routers/computers Fixed length (32, 128 bit) Example: single host Example: network range 2001:0628:0408:0100::/64 Protocol Address is a combination of IP address and port number (TCP or UDP Service Access Point) 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 27 Hilmar Linder 27

28 Byte Ordering Big Endian vs. Little Endian Little Endian: least byte of word is stored at the lowest memory address Big Endian: most significant byte of word is stored at the lowest memory address Network byte order Big Endian Platform independence Must be used for some data (i.e. IP addresses) Functions to convert 16- and 32-bit numbers uint16_t htons(uint16_t hostshort) uint16_t ntohs(uint16_t hostshort) uint32_t htonl(uint32_t hostlong) uint32_t ntohl(uint32_t hostlong) 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 28 Hilmar Linder 28

29 IPv4 Socket Address Structure IPv4 address (<netinet/in.h>): struct in_addr { in_addr_t saddr; // 32-bit IP address } TCP or UDP address: struct sockaddr_in { uint8_t sin_len; // len (16) uint8_t sin_family; // AF_INET unit16_t sin_port; // port number struct in_addr sin_addr; // IPv4 address char sin_zero[8] // unused } 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 29 Hilmar Linder 29

30 IPv6 Socket Address Structure IPv6 address (<netinet/in.h>) : struct in6_addr { uint8_t s6_addr[16]; // 128-bit IP address } TCP or UDP address: struct sockaddr_in6 { uint8_t sin6_len; // len (24) uint8_t sin6_family; // AF_INET6 uint16_t sin6_port; // port number uint32_t sin6_flowinfo; // flow label struct in6_addr sin6_addr; // IPv6 address /* uint32_t sin6_scope_id; // IPv6 scope id */ } 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 30 Hilmar Linder 30

31 Generic Socket Address Socket functions must deal with socket address structures from any supported protocol family struct sockaddr { uint8_t sa_len; uint8_t sa_family; // AF_XXX char sa_data[14]; // protocol specific address } 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 31 Hilmar Linder 31

32 Address Conversion Functions int inet_aton( const char *strptr, struct in_addr *addrptr ); in_addr_t inet_addr( const char *strptr) ; char *inet_ntoa( struct in_addr inaddr ); int inet_pton( int family, const char *strptr, void *addrptr); const char *inet_ntop( int family, const void *addrptr, char *strptr, size_t len); 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 32 Hilmar Linder 32

33 Excurs: Pointers in C int x = 1, int y = 2; int *ip; /* ip is a pointer to int */ ip = &x; /* ip points to x */ y = *ip; /* y = 1 */ void swap(int x, int y) { /* FALSCH */ int temp; temp = x; x = y; y = temp; } swap(a, b); /* call by value, swaps only copies of a and b */ void swap(int *px, int *py) { int temp; temp = *px; *px = *py; *py = temp; } swap(&a, &b); /* call by reference */ 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 33 Hilmar Linder 33

34 Function socket() Create a local communication end-point #include <sys/socket.h> int socket( int family, int type, int protocol ); Family PF_INET for IPv4 PF_INET6 for IPv6 PF_LOCAL, PF_UNIX for UNIX domain protocol Type SOCK_STREAM for TCP SOCK_DGRAM for UDP Protocol Protocol within family, typically 0 (except for raw sockets) 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 34 Hilmar Linder 34

35 Socket Descriptor Data - Internal Structure Descriptor Table Family: PF_INET Service: SOCK_STREAM Local IP: x.x.x.x Remote IP: y.y.y.y Local Port: 2249 Remote Port: /20/2004 VP VIS, Hilmar Linder, WS '04/05 35 Hilmar Linder 35

36 Specifying an Endpoint Address Remember that the sockets API is generic There must be a generic way to specify endpoint addresses TCP/IP requires an IP address and a port number for each endpoint address Other protocol suites (families) may use other schemes 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 36 Hilmar Linder 36

37 Function bind() Assign a local protocol address to a socket int bind( int sockfd, const struct sockaddr *myaddr, socklen_t addrlen ); sockfd: socket file descriptor myaddr: protocol specific address IP address is set by NOS if value passed is INADDR_ANY, else set by caller Port number is set by NOS if value passed is 0, else set by caller addrlen: length of address structure 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 37 Hilmar Linder 37

38 Example: Usage of bind() int mysock,err; struct sockaddr_in myaddr; mysock = socket(pf_inet,sock_stream,0); myaddr.sin_family = AF_INET; myaddr.sin_port = htons( portnum ); myaddr.sin_addr = htonl( ipaddress); err = bind( mysock, (sockaddr *) &myaddr, sizeof(myaddr) ); 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 38 Hilmar Linder 38

39 IP Address/Port Combinations IP Address INADDR_ANY INADDR_ANY Local IP address Local IP address Port 0 Nonzero Nonzero 0 Result Kernel chooses IP address and port Kernel chooses IP address, process specifies port Process specifies IP address, kernel chooses port Process specifies IP address and port 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 39 Hilmar Linder 39

40 Function listen() Put a socket into passive state (wait for incoming connections) int listen( int sockfd, int backlog ); sockfd: socket file descriptor backlog: number of connections that the kernel should queue for this socket accept() completed 3WHS complete incomplete SYN arrives 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 40 Hilmar Linder 40

41 Function connect() A TCP client wants to establish a connection with a TCP server Initiates 3WHS and returns only when a connection is established or on error int connect( int sockfd, const struct sockaddr *servaddr, socklen_t addrlen ); sockfd: socket file descriptor servaddr: IP address and port number of server addrlen: length of address structure 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 41 Hilmar Linder 41

42 Function accept() (1) Accept incoming connection Function returns: new socket descriptor, the protocol address of the client and the size of this address int accept( int sockfd, struct sockaddr *cliaddr, socklen_t *addrlen ); sockfd: socket file descriptor cliaddr: IP address and port number of the client addrlen: length of address structure 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 42 Hilmar Linder 42

43 Function accept() (2) A server uses two sockets: one for accepting connections, another for send/receive server client 1 connection socket data socket client 2 connection operation send/receive operation 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 43 Hilmar Linder 43

44 Value-Result Arguments bind, connect and sendto pass a socket address structure to the kernel accept, recvfrom, getsockname and getpeername pass a socket address structure from the kernel. Value-Result Argument: used both as in and out parameter Use the length field parameter to tell the kernel the size of the structure passed to tell the process how much information the kernel has actually stored in the structure 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 44 Hilmar Linder 44

45 Sending and Receiving Data Write data to a stream (TCP) or connected datagram (UDP) socket int write( int sockfd, char *buf, size_t nbytes ); Read data from a stream (TCP) or connected datagram (UDP) socket int read( int sockfd, char *buf, size_t nbytes ); Reasons for partial reads/writes: Process received interrupt or signal Kernel buffers unavailable 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 45 Hilmar Linder 45

46 Sending and Receiving Data Send a datagram over a UDP socket int sendto( int sockfd, char *buf, size_t nbytes, int flags, struct sockaddr *to, socklen_t addrlen ); Read a datagram from a UDP socket int recvfrom( int sockfd, char *buf, size_t nbytes, int flags, struct sockaddr *from, socklen_t *addrlen ); 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 46 Hilmar Linder 46

47 Function close() / shutdown() Close a socket int close( int sockfd ); sockfd: socket file descriptor Force termination of communication int shutdown( int sockfd, int howto ); sockfd: socket file descriptor Howto: SHUT_RD to stop receiving (queued data is discarded) SHUT_WR to stop sending (queued data is sent) SHUT_RDWR to stop both 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 47 Hilmar Linder 47

48 TCP Client/Server Example (1) Server socket() bind() Client listen() socket() Block until connect Process request accept() recv() send() Connection Establishment Data (request) Data (reply) connect() send() recv() 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 48 Hilmar Linder 48

49 TCP Client/Server Example (2) socket() connect() connect Completes write() read() close() SYN X SYN Y, ACK X+1 ACK Y+1 FIN M ACK M+1 FIN N socket() bind() listen() accept completes read() write() passive close (read returns 0) close() ACK N+1 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 49 Hilmar Linder 49

50 UDP Client/Server Example Block until data from client arrives Server socket() bind() recvfrom() Data (request) Client socket() bind() sendto() Process request sendto() Data (reply) recvfrom() 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 50 Hilmar Linder 50

51 Practical Issues (1) Be careful when using socket calls Specific data structures and formats Ports cannot be less than 1024 without root privileges (permission denied) You can use other tools to see if things are working tcpdump /proc (on Linux) netstat, nc Think about error handling methods 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 51 Hilmar Linder 51

52 Practical Issues (2) Windows implements socket interface in a slightly different way #include <winsock2.h> WSAStartup/WSACleanup closesocket Different names for asynchronous sockets, WSAxxx WSAGetLastError instead of errno use send/recv instead of write/read 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 52 Hilmar Linder 52

53 Java Stream Mode Socket API (1) Data is transferred using the concept of a continuous data stream flowing from a source to a destination The ServerSocket class: Method/Constructor ServerSocket(int port) Descriptor Creates a server socket on the specified port Socket accept() throws IOException void close() throws IOException Listens for a connection to be made to this socket and accepts it. The method blocks until a connection is made Closes the socket Void setsotimeout(int timeout) throws SocketException Sets a timeout period (in msec) so that a call to accept() for this socket will block for only this amount of time 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 53 Hilmar Linder 53

54 Java Stream Mode Socket API (2) The (client-side) Socket class: Method/Constructor Socket(InetAddress address, int port) void close() throws IOException InputStream getinputstream() throws IOException OutputStream getoutputstream() throws IOException Void setsotimeout(int timeout) throws SocketException Description Creates a stream socket and connects it to the specified port number at the specified IP address Closes this port Returns an input stream so that data may be read from this socket Returns an output stream so that data may be written to this socket Sets a timeout period for blocking so that read() call on the InputStream associated with this socket will block for only this amount of time. If the timeout expires, a java.io.interruptedioexception is raised 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 54 Hilmar Linder 54

55 Example: TCP based Server import java.net.*; import java.io.*; public class Server { // An application that accepts a connection and receives a message using stream-mode socket. // Two command line arguments are expected, in order: // <port number for the the Server socket used in this process> // <message, a string, to send> public static void main(string[] args) { if (args.length!= 2) System.out.println ("This program requires three command line arguments"); else { try { int portno = Integer.parseInt(args[0]); String message = args[1]; // instantiates a socket for accepting connection ServerSocket connectionsocket = new ServerSocket(portNo); // wait to accept a connecion request Socket datasocket = connectionsocket.accept(); // get a output stream for writing to the data socket OutputStream outstream = datasocket.getoutputstream(); // create a PrinterWriter object for character-mode output PrintWriter socketoutput = new PrintWriter(new OutputStreamWriter(outStream)); // write a message into the data stream socketoutput.println(message); //The flush method call is necessary for the data to be written to the socket data stream before the socket is closed. socketoutput.flush(); datasocket.close( ); connectionsocket.close( ); } // end try catch (Exception ex) { ex.printstacktrace( ); } //end catch } // end else } // end main } // end class 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 55 Hilmar Linder 55

56 Example: TCP based Client import java.net.*; import java.io.*; public class Client { // An application that sends a message using stream-mode socket. // Two command line arguments are expected: // // <host name of the connection accceptor> // <port number of the connection accceptor> public static void main(string[] args) { if (args.length!= 2) System.out.println ("This program requires two command line arguments"); else { try { InetAddress acceptorhost = InetAddress.getByName(args[0]); int acceptorport = Integer.parseInt(args[1]); // instantiates a data socket and connect with a timeout SocketAddress sockaddr = new InetSocketAddress(acceptorHost, acceptorport); Socket mysocket = new Socket(); int timeoutperiod = 5000; mysocket.connect(sockaddr, timeoutperiod); // get an input stream for reading from the data socket InputStream instream = mysocket.getinputstream(); // create a BufferedReader object for text line input BufferedReader socketinput = new BufferedReader(new InputStreamReader(inStream)); // read a line from the data stream String message = socketinput.readline( ); System.out.println("Message received:"); System.out.println("\t" + message); mysocket.close( ); } // end try catch (Exception ex) { ex.printstacktrace( ); } } // end else } // end main } // end class 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 56 Hilmar Linder 56

57 Java Datagram Socket API The DatagramPacket and DatagramSocket class: Method/Constructor DatagramPacket(byte[] buf, int length) DatagramPacket(byte[] buf, int length, InetAddress address, int port) DatagramSocket() DatagramSocket(int) void close() void receive(datagrampacket p) void send(datagrampacket p) Description Constructs a datagram packet for receiving packets of length length; data received will be stored in buf Constructs a datagram packet for sending on the socket bound to the specified port number and host Creates a datagram socket and binds it to any available port on the local machine Creates a datagram socket and binds it to the specified port on the local machine Closes the datagram socket Receives a datagram packet Sends a datagram packet 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 57 Hilmar Linder 57

58 References A. D. Marshall, Programming in C, Sockets Tutorial, ock.html C. Morris, Programming Sockets and RMI, utorial.html All about Sockets, ng/sockets/ 10/20/2004 VP VIS, Hilmar Linder, WS '04/05 58 Hilmar Linder 58

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

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

Network programming(i) Lenuta Alboaie

Network 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 information

CLIENT-SIDE PROGRAMMING

CLIENT-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 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

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

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

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

Hybrid of client-server and P2P. Pure P2P Architecture. App-layer Protocols. Communicating Processes. Transport Service Requirements

Hybrid of client-server and P2P. Pure P2P Architecture. App-layer Protocols. Communicating Processes. Transport Service Requirements Announcements CS 5565 Network Architecture and Protocols Lecture 5 Godmar Back Problem Set 1 due Feb 17 Project 1 handed out shortly 2 Layer The Layer Let s look at some s (in keeping with top-down) architectures:

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

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

WinSock. 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 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 information

sottotitolo Socket Programming Milano, XX mese 20XX A.A. 2016/17 Federico Reghenzani

sottotitolo 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 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

TCP: Three-way handshake

TCP: 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 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

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

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

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

SOCKETS. COMP750 Distributed Systems

SOCKETS. COMP750 Distributed Systems SOCKETS COMP750 Distributed Systems Sockets The Socket library is a traditional Application Program Interface (API) to the transport layer. Sockets were originally implemented in Unix systems and have

More information

Outline. Operating Systems. Socket Basics An end-point for a IP network connection. Ports. Network Communication. Sockets and the OS

Outline. 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 information

Outline. Distributed Computing Systems. Socket Basics (1 of 2) Socket Basics (2 of 2) 3/28/2014

Outline. 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 information

Socket Programming TCP UDP

Socket 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 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

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

Outline. 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 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 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

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

Socket Programming. Dr. -Ing. Abdalkarim Awad. Informatik 7 Rechnernetze und Kommunikationssysteme

Socket 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 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

Context. Distributed Systems: Sockets Programming. Alberto Bosio, Associate Professor UM Microelectronic Departement

Context. 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 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

Session NM056. Programming TCP/IP with Sockets. Geoff Bryant Process software

Session 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 information

Socket Programming(2/2)

Socket Programming(2/2) Socket Programming(2/2) 1 Outline 1. Introduction to Network Programming 2. Network Architecture Client/Server Model 3. TCP Socket Programming 4. UDP Socket Programming 5. IPv4/IPv6 Programming Migration

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

Network Programming Worksheet 2. Simple TCP Clients and Servers on *nix with C.

Network 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 information

Announcements. CS 5565 Network Architecture and Protocols. Queuing. Demultiplexing. Demultiplexing Issues (1) Demultiplexing Issues (2)

Announcements. CS 5565 Network Architecture and Protocols. Queuing. Demultiplexing. Demultiplexing Issues (1) Demultiplexing Issues (2) Announcements CS 5565 Network Architecture and Protocols Problem Set 1 due Feb 18 Project 1A due Feb 19 Lecture 5 Godmar Back 2 Queuing Demultiplexing send queues Layer k+1 Layer k recv queues End systems

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

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

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

Lecture 3: Socket Programming

Lecture 3: Socket Programming Lecture 3: Socket Programming Prof. Shervin Shirmohammadi SITE, University of Ottawa Fall 2005 CEG4183/ELG4183 3-1 Sockets From a logical perspective, a Socket is a communication end point. It is not a

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

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

Types (Protocols) Associated functions Styles We will look at using sockets in C Java sockets are conceptually quite similar

Types (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 information

Network Programming in C. Networked Systems 3 Laboratory Sessions and Problem Sets

Network 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 information

STUDY OF SOCKET PROGRAMMING

STUDY OF SOCKET PROGRAMMING STUDY OF SOCKET PROGRAMMING Sockets : An application programming interface(api) used for inter process communication. Sockets allow communication between two different processes on the same or different

More information

A Socket Example. Haris Andrianakis & Angelos Stavrou George Mason University

A Socket Example. Haris Andrianakis & Angelos Stavrou George Mason University A Socket Example & George Mason University Everything is a file descriptor Most socket system calls operate on file descriptors Server - Quick view socket() bind() listen() accept() send(), recv() close()

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

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

CS 43: Computer Networks. 05: Socket Programming September 12-14, 2018

CS 43: Computer Networks. 05: Socket Programming September 12-14, 2018 CS 43: Computer Networks 05: Socket Programming September 12-14, 2018 Reading Quiz Lecture 5/6 - Slide 2 Socket Programming Adapted from: Donahoo, Michael J., and Kenneth L. Calvert. TCP/IP sockets in

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

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

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

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

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

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

UNIT IV- SOCKETS Part A

UNIT IV- SOCKETS Part A 1. Define sockets - SOCKETS Part A A socket is a construct to provide a communication between computers. It hides the underlying networking concepts and provides us with an interface to communicate between

More information

CSE 124 Discussion Section Sockets Programming 10/10/17

CSE 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 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 Network Programming. Overview of Socket API Network Programming Basics

UNIX 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 information

CSE 333 SECTION 8. Sockets, Network Programming

CSE 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 information

Lecture 3 Overview! Last Lecture! TCP/UDP and Sockets introduction!

Lecture 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 information

EEC-484/584 Computer Networks

EEC-484/584 Computer Networks EEC-484/584 Computer Networks Lecture 15 wenbing@ieee.org (Lecture nodes are based on materials supplied by Dr. Louise Moser at UCSB and Prentice-Hall) Outline 2 Review of last lecture The network layer

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

CSE 333 SECTION 7. C++ Virtual Functions and Client-Side Network Programming

CSE 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 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

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

System Programming. Sockets

System 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 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

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

Socket Programming. Sungkyunkwan University. Hyunseung Choo Copyright Networking Laboratory

Socket Programming. Sungkyunkwan University. Hyunseung Choo Copyright Networking Laboratory Socket Programming Sungkyunkwan University Hyunseung Choo choo@skku.edu Copyright 2000-2019 Networking Laboratory Contents Goals Client-Server mechanism Introduction to socket Programming with socket on

More information

Internet applications

Internet applications CSc 450/550 Computer Networks Worldwide Web Jianping Pan Summer 2006 5/18/06 CSc 450/550 1 Traditionally Internet applications remote login: e.g., telnet file transfer: e.g., FTP electronic mail: e.g.,

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

CSE 333 SECTION 7. Client-Side Network Programming

CSE 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 information

Unix Network Programming Chapter 4. Elementary TCP Sockets 광운대학교컴퓨터과학과 정보통신연구실 석사과정안중현

Unix Network Programming Chapter 4. Elementary TCP Sockets 광운대학교컴퓨터과학과 정보통신연구실 석사과정안중현 Unix Network Programming Chapter 4. Elementary TCP Sockets 광운대학교컴퓨터과학과 정보통신연구실 석사과정안중현 4.1 Introduction A Time line of the typical scenario that takes place between a TCP client and server. Describes the

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

Interprocess Communication

Interprocess Communication Interprocess Communication Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5 Introduction Applications, services

More information

Lecture 5 Overview! Last Lecture! This Lecture! Next Lecture! I/O multiplexing! Source: Chapter 6 of Stevens book!

Lecture 5 Overview! Last Lecture! This Lecture! Next Lecture! I/O multiplexing! Source: Chapter 6 of Stevens book! Lecture 5 Overview! Last Lecture! I/O multiplexing! Source: Chapter 6 of Stevens book! This Lecture! Socket options! Source: Chapter 7 of Stevens book! Elementary UDP sockets! Source: Chapter 8 of Stevens

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

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

Client Server Computing

Client 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 information

Systems software design NETWORK COMMUNICATIONS & RPC SYSTEMS

Systems 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 information

Introduction to Network Programming using C/C++

Introduction to Network Programming using C/C++ Introduction to Network Programming using C/C++ Slides mostly prepared by Joerg Ott (TKK) and Olaf Bergmann (Uni Bremen TZI) 1 Would be giving brief introduction on... Parsing Command line Socket Related

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

CSE 333 SECTION 6. Networking and sockets

CSE 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 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

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

Networking and Security

Networking and Security Chapter 03 Networking and Security Mr. Nilesh Vishwasrao Patil Government Polytechnic Ahmednagar Socket Network socket is an endpoint of an interprocess communication flow across a computer network. Sockets

More information

CSc 450/550 Computer Networks Network Architectures & Client-Server Model

CSc 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 information

Communication. Sockets (Haviland Ch. 10)

Communication. 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 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

UNIT 1 TCP/IP PROGRAMMING CONCEPTS

UNIT 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 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

Lecture 24. Thursday, November 19 CS 375 UNIX System Programming - Lecture 24 1

Lecture 24. Thursday, November 19 CS 375 UNIX System Programming - Lecture 24 1 Lecture 24 Log into Linux. Copy directory /home/hwang/cs375/lecture24 Final project posted. Due during finals week. Reminder: No class next Tuesday (11/24) Questions? Thursday, November 19 CS 375 UNIX

More information

CSCD 330 Network Programming Spring 2018

CSCD 330 Network Programming Spring 2018 CSCD 330 Network Programming Spring 2018 Lecture 6 Application Layer Socket Programming in Java Reading for Java Client/Server see Relevant Links Some Material in these slides from J.F Kurose and K.W.

More information

Network Programming Week #1. K.C. Kim

Network Programming Week #1. K.C. Kim Network Programming Week #1 K.C. Kim kckim@konkuk.ac.kr How do we communicate? Mail Example 1. Write a mail 2. Put the mail into a mailbox 3. Post office classify mails based on the address 4. Cars, airplanes

More information

CSE 333 Lecture 16 - network programming intro

CSE 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 information

IPv6 Porting Applications

IPv6 Porting Applications IPv6 Porting Applications US IPv6 Summit Dec 8-11, 8 2003 Eva M. Castro eva@gsyc.escet.urjc.es Systems and Communications Group (GSyC( GSyC) Experimental Sciences and Technology Department (ESCET) Rey

More information

Introduction and Overview Socket Programming Lower-level stuff Higher-level interfaces Security. Network Programming. Samuli Sorvakko/Nixu Oy

Introduction and Overview Socket Programming Lower-level stuff Higher-level interfaces Security. Network Programming. Samuli Sorvakko/Nixu Oy Network Programming Samuli Sorvakko/Nixu Oy Telecommunications software and Multimedia Laboratory T-110.4100 Computer Networks October 5, 2009 Agenda 1 Introduction and Overview 2 Socket Programming 3

More information

CSCD 330 Network Programming Winter 2019

CSCD 330 Network Programming Winter 2019 CSCD 330 Network Programming Winter 2019 Lecture 7 Application Layer Socket Programming in Java Reading: Chapter 2, Java links Relevant Links page Some Material in these slides from J.F Kurose and K.W.

More information