CS11 C++ DGC. Spring Lecture 6

Size: px
Start display at page:

Download "CS11 C++ DGC. Spring Lecture 6"

Transcription

1 CS11 C++ DGC Spring Lecture 6

2 The Spread Toolkit A high performance, open source messaging service Provides message-based communication Point-to-point messaging Group communication (aka broadcast or multicast communication) Heavy focus on safety and reliability Source, binaries, and docs available at

3 Spread vs. TCP, UDP, etc. Many networking applications use TCP/IP Transmission Control Protocol A reliable, stream-based protocol Spread is message-based; less suitable for streaming apps Some applications use UDP User Datagram Protocol Can implement broadcast (to subnet) or multicast with UDP UDP is unreliable and unordered! Spread can provide either unreliable or reliable broadcast and multicast As usual, pick the right tool for the job.

4 How Spread Works Spread consists of two parts: A library of functions that your program uses SP_connect, SP_multicast, SP_receive, etc. A set of daemons that forms a Spread network Configuration of network driven by a spread.conf file Daemons must be running for Spread programs to communicate! Spread can leverage multiple underlying communication layers TCP, UDP, multicast, etc.

5 Spread Groups Spread is based on notion of groups Clients join one or more groups Messages are sent to an entire group Each client also has its own private group No one else can join that group Can send messages to a particular client s private group, for point-to-point communication Spread provides group membership change notifications If a client joins, leaves, or is disconnected from a particular group, membership messages are sent to the whole group

6 Ordering and Reliability For group messaging, two major concerns: Do messages actually show up at all? What order do messages show up at a receiver? What order with respect to a particular sender? What global order with respect to all senders? Messaging libraries provide reliability guarantees and ordering guarantees Spread provides six different levels of service Different combinations of reliability and ordering guarantee Can specify level of service when each message is sent

7 Spread Guarantees UNRELIABLE_MESS No reliability guarantee an unreliable message may be dropped! No ordering guarantee any unreliable message can arrive before or after any other unreliable message RELIABLE_MESS Spread will make a best effort to deliver the message to all group members No ordering guarantee just like UNRELIABLE_MESS

8 Spread Guarantees (2) FIFO_MESS Messages are delivered reliably (best effort) Messages from a particular source are received in the same order that the source sent them Clients may still get different total message order Sender 1 Sender 2 A 2 B 2 A 1 B 1 Spread Network B 2 A 2 B 1 A 2 B 2 B 1 A 1 A 1 Client 1 Client 2

9 Spread Guarantees (3) CAUSAL_MESS Messages are delivered reliably Messages arrive in a causal ordering General idea: If the receiving of one message could have caused the sending of another message, then they are received in that order by all clients. Example: Message M 1 is received by a client, and then the client sends message M 2. Other clients that receive both M 1 and M 2 receive M 1 first. Only specifies a partial ordering, not a total order over all messages

10 Spread Guarantees (4) AGREED_MESS Specifies a total order of all messages, over all senders All receivers get messages in exact same order SAFE_MESS Same ordering guarantee as AGREED_MESS Spread doesn t deliver message to recipients until every single daemon is ready to deliver message Idea: Make sure every member gets this message! If membership changes occur, Spread provides appropriate synchronization messages

11 Spread API Spread API is written for C programming Can use from C++, but no exceptions, classes, etc. Errors indicated by an int return code Value less than 0 always indicates an error A value of 0 sometimes means success Some functions return number of bytes sent on success (normally > 0) For error situations: void SP_error(int error) Prints error description to stdout (probably using a printf family function) Can t really incorporate into C++ stream IO and cout/cerr

12 Spread Types Group names specified as char* Maximum length: MAX_GROUP_NAME Can use string literals to specify group names e.g. "chat-group" Or, use std::string, and c_str() function All communication operations require a mailbox Provides communication context for Spread API Spread provides a mailbox type (in Spread 3, it s an int)

13 Connecting Use SP_connect to connect to a Spread daemon int SP_connect(const char *spread_name, const char *private_name, int priority, int group_membership, mailbox *mbox, char *private_group) spread_name specifies connection details for a Spread daemon Valid forms: 4803 Port on local machine 4803@localhost Same (Windows friendly) 4803@host.domain.tld Port on a remote machine 4803@ Same

14 Connecting (2) int SP_connect(const char *spread_name, const char *private_name, int priority, int group_membership, mailbox *mbox, char *private_group) private_name specifies name of local connection Must be unique on the machine! Can pass in NULL (or 0) Spread daemon will assign a random, unique name to connection priority specifies low (0) or high (1) priority Currently ignored; pass in 0. group_membership indicates whether client wants to receive membership-change messages 0 = no, 1 = yes

15 Connecting (3) int SP_connect(const char *spread_name, const char *private_name, int priority, int group_membership, mailbox *mbox, char *private_group) mbox and private_group are out-parameters Pass in pointers to variables to receive the values On successful connect, Spread sets these to valid values mbox is the mailbox to use for Spread operations private_group is the name of the connection s private group, for use with point-to-point communication

16 Example Spread Connect Code // Hard-coded connection info (not the best) const char * SpreadName = "4803@localhost"; // Variables to receive output from Spread mailbox mbox; char priv_group_name[max_group_name]; // No private name; priority = 0; recv group msgs = 1 rc = SP_connect(SpreadName, 0, 0, 1, &mbox, priv_group_name); if (rc!= ACCEPT_SESSION) { // Might be better to throw some kind of exception SP_error(rc); return -1; } cout << "Connected. Private group name = \"" << priv_group_name << "\"." << endl;

17 Spread Connection Details Each connection will have a mailbox and a private group name Make a struct/class to manage this info Can easily pass Spread connection info to various functions Don t enable membership messages unless you really want/need them If you don t need them, you will have to receive (and ignore) them

18 Disconnection Disconnection is much simpler: int SP_disconnect(mailbox mbox) Pass in mailbox, and that s that. Check return code for errors, of course. Only real error in this situation is invalid mailbox Check anyway make debugging easier down the road!

19 Joining and Leaving Groups To join a group: int SP_join(mailbox mbox, const char *group) Group s name is a string Length shorter than MAX_GROUP_NAME (32 chars, but don t bank on that ) Terminated by a 0, like all good C strings Can include letters, numbers, and punctuation from the set -/_.\ (specifically not #!) If group doesn t already exist, it is created To leave a group: int SP_leave(mailbox mbox, const char *group) If group doesn t exist, this is a no-op.

20 Sending Messages Can send messages to one group, or to several groups SP_multicast SP_multigroup_multicast In memory, message can be contiguous or fragmented SP_scat_multicast SP_multigroup_scat_multicast Functions are all similar in capability

21 Sending Messages (2) Normal send message function: int SP_multicast(mailbox mbox, service service_type, const char *group, int16 mess_type, int mess_len, const char *mess) service_type specifies delivery guarantees Can be set to: UNRELIABLE_MESS RELIABLE_MESS FIFO_MESS CAUSAL_MESS AGREED_MESS SAFE_MESS Can also bitwise-or in SELF_DISCARD, if desired: RELIABLE_MESS SELF_DISCARD Otherwise, a client also receives its own messages

22 Sending Messages (3) int SP_multicast(mailbox mbox, service service_type, const char *group, int16 mess_type, int mess_len, const char *mess) group specifies group to send the message to Must be less than MAX_GROUP_NAME bytes in length If sender is in group, they receive the message too, unless SELF_DISCARD was specified mess_type is an application-defined message type value 16-bit value: to Keeps applications from having to look into message body to determine message s type very useful!

23 Sending Messages (4) int SP_multicast(mailbox mbox, service service_type, const char *group, int16 mess_type, int mess_len, const char *mess) mess_len specifies message s length Usually, messages must be less than a few hundred KB Probably want to stay under a few dozen KB max! mess is the actual message data! Whatever you decide to send

24 Receiving Messages Normal receive message function: int SP_receive(mailbox mbox, service *service_type, char sender[max_group_name], int max_groups, int *num_groups, char groups[][max_group_name], int16 *mess_type, int *endian_mismatch, int max_mess_len, char *mess) Receives both application messages and membershipchange messages unless client specifies no membership messages to SP_connect, of course Most parameters are out-parameters! SP_receive is a blocking call won t return until a message was received, or an error occurs Also a scatter-receive version: SP_scat_receive

25 Receiving Messages (2) int SP_receive(mailbox mbox, service *service_type, char sender[max_group_name], int max_groups, int *num_groups, char groups[][max_group_name], int16 *mess_type, int *endian_mismatch, int max_mess_len, char *mess) Return value: Value < 0 indicates an error On success, result is number of bytes received Meaning of arguments depends on whether message is from application, or a membershipchange message See API documentation for all the details

26 Receiving Messages (3) int SP_receive(mailbox mbox, service *service_type, char sender[max_group_name], int max_groups, int *num_groups, char groups[][max_group_name], int16 *mess_type, int *endian_mismatch, int max_mess_len, char *mess) service_type recieves the kind of message REGULAR_MESS and MEMBERSHIP_MESS constants are used to tell what kind of message These are bit-fields; need bitwise logic operations to check For application messages, sender receives private group name of sender Meaning is different for membership messages

27 Service-Type Value Different values are represented with different bit patterns: UNRELIABLE_MESS 0x RELIABLE_MESS 0x FIFO_MESS 0x CAUSAL_MESS 0x AGREED_MESS 0x SAFE_MESS 0x REGULAR_MESS 0x f REG_MEMB_MESS 0x TRANSITION_MESS 0x CAUSED_BY_JOIN 0x CAUSED_BY_LEAVE 0x CAUSED_BY_DISCONNECT 0x CAUSED_BY_NETWORK 0x MEMBERSHIP_MESS 0x00003f00

28 Service-Type Value (2) Use bitwise Boolean operators to check service_type value (service_type & REGULAR_MESS) is nonzero when the message is an application message (service_type & MEMBERSHIP_MESS) is nonzero when the message is a membership message Or, use macros provided by Spread API Is_regular_mess(service_type) Is_membership_mess(service_type) Is_unreliable_mess(service_type) Is_reliable_mess(service_type) etc.

29 Receiving Messages (4) For application messages: int SP_receive(mailbox mbox, service *service_type, char sender[max_group_name], int max_groups, int *num_groups, char groups[][max_group_name], int16 *mess_type, int *endian_mismatch, int max_mess_len, char *mess) max_groups, num_groups, and groups array report what groups message was sent to Meaning changes for membership messages! mess_type receives app-specific message type mess points to buffer that receives message data Specify max_mess_len correctly to avoid buffer overflows!

30 Insufficient Buffer Space If message is larger than provided buffer, Spread won t deliver the message Some APIs simply truncate the message down to the buffer size, so this is nicer Also, if groups array doesn t have enough entries for all groups, Spread won t deliver the message In these cases, Spread will report how much space is actually needed See API documentation for details Can allocate more space, then retry the receive operation To force Spread to truncate message/group data Set service_type = DROP_RECV before calling SP_receive function (usually not recommended)

31 Endian Issues SP_receive also provides endian_mismatch property Spread sets this value based on sender and receiver endian-ness 1 = sender stores words in a different byte-order than receiver 0 = sender stores words in the same byte-order as receiver Spread ensures that mess_type is converted properly Message contents may not be converted properly! Spread doesn t know what your message format is Have to do this yourself See htons, htonl, ntohs, ntohl functions, for example

32 Example Spread Receive Code service svc_type; char sender[max_group_name]; int max_groups = 16; // Max groups we have space for char groups[16][max_group_name]; int num_groups; // Number of actual groups int16 msg_type; int endian_mismatch; int max_msg_length = 1024; char message[1024]; svc_type = 0; // or DROP_RECV to truncate rc = SP_receive(mbox, &svc_type, sender, max_groups, &num_groups, groups, &msg_type, &endian_mismatch, max_msg_length, message);

33 Making Spread C++ Friendly Some suggestions for making Spread easier to work with in C++ Make a spread_error exception type that derives from runtime_error Just like POSIX threading exception type Include return-code value for exceptions Make a struct to hold Spread connection info Mailbox and private group name Could also turn this into a full-fledged class Constructor connects, destructor disconnects, etc.

34 Making Spread C++ Friendly (2) Create a class to wrap Spread messages Include both message data, and list of groups Provide functions to read and write primitives perhaps in network byte-order to avoid endian issues Dynamically grow the buffer as needed Write wrappers for both SP_multicast and SP_receive that use the message class Avoid all the crazy in/out parameters Can even handle insufficient space issues by growing the necessary buffer, then retrying

35 This Week s Lab Create a simple echo-server using Spread Your program connects to a Spread daemon and joins a well known (i.e. hard-coded) group Program can be started in one of two modes: In send mode, your program requests user input, then sends typed messages to Spread group In receive mode, your program receives the Spread messages and prints them out When user types quit the whole thing stops Spread Toolkit is installed on the CS cluster Lab write-up tells how to build your program to use Spread, how to start Spread running, etc.

CS11 C++ DGC. Spring Lecture 7

CS11 C++ DGC. Spring Lecture 7 CS11 C++ DGC Spring 2006-2007 Lecture 7 This Week s Lab Build a basic instant messaging program using Spread Console-based user interface, using ncurses User can type chat messages or commands Also need

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

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

COMP/ELEC 429/556 Introduction to Computer Networks

COMP/ELEC 429/556 Introduction to Computer Networks COMP/ELEC 429/556 Introduction to Computer Networks Creating a Network Application Some slides used with permissions from Edward W. Knightly, T. S. Eugene Ng, Ion Stoica, Hui Zhang 1 How to Programmatically

More information

CSE 461 Module 10. Introduction to the Transport Layer

CSE 461 Module 10. Introduction to the Transport Layer CSE 461 Module 10 Introduction to the Transport Layer Last Time We finished up the Network layer Internetworks (IP) Routing (DV/RIP, LS/OSPF, BGP) It was all about routing: how to provide end-to-end delivery

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

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

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

Network Software Implementations

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

More information

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

ECE 650 Systems Programming & Engineering. Spring 2018

ECE 650 Systems Programming & Engineering. Spring 2018 ECE 650 Systems Programming & Engineering Spring 2018 Networking Transport Layer Tyler Bletsch Duke University Slides are adapted from Brian Rogers (Duke) TCP/IP Model 2 Transport Layer Problem solved:

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

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

Operating Systems and Networks Project 1: Reliable Transport

Operating Systems and Networks Project 1: Reliable Transport Spring Term 2016 Operating Systems and Networks Project 1: Reliable Transport Assigned on: 22 April 2016 Due by: 13 May 2016 1 Introduction In this project, your task is to implement a reliable sliding

More information

External Data Representation (XDR)

External Data Representation (XDR) External Data Representation (XDR) Prof. Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology Taipei, TAIWAN NTUT, TAIWAN 1 Introduction This chapter examines

More information

Vector and Free Store (Pointers and Memory Allocation)

Vector and Free Store (Pointers and Memory Allocation) DM560 Introduction to Programming in C++ Vector and Free Store (Pointers and Memory Allocation) Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark [Based on slides

More information

Interprocess Communication

Interprocess Communication Interprocess Communication Nicola Dragoni Embedded Systems Engineering DTU Informatics 4.2 Characteristics, Sockets, Client-Server Communication: UDP vs TCP 4.4 Group (Multicast) Communication The Characteristics

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

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

ECE 650 Systems Programming & Engineering. Spring 2018

ECE 650 Systems Programming & Engineering. Spring 2018 ECE 650 Systems Programming & Engineering Spring 2018 Programming with Network Sockets Tyler Bletsch Duke University Slides are adapted from Brian Rogers (Duke) Sockets We ve looked at shared memory vs.

More information

CS24 Week 3 Lecture 1

CS24 Week 3 Lecture 1 CS24 Week 3 Lecture 1 Kyle Dewey Overview Some minor C++ points ADT Review Object-oriented Programming C++ Classes Constructors Destructors More minor Points (if time) Key Minor Points const Motivation

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

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

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 21: Network Protocols (and 2 Phase Commit)

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 21: Network Protocols (and 2 Phase Commit) CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2003 Lecture 21: Network Protocols (and 2 Phase Commit) 21.0 Main Point Protocol: agreement between two parties as to

More information

Request for Comments: 913 September 1984

Request for Comments: 913 September 1984 Network Working Group Request for Comments: 913 Mark K. Lottor MIT September 1984 STATUS OF THIS MEMO This RFC suggests a proposed protocol for the ARPA-Internet community, and requests discussion and

More information

Ch. 12: Operator Overloading

Ch. 12: Operator Overloading Ch. 12: Operator Overloading Operator overloading is just syntactic sugar, i.e. another way to make a function call: shift_left(42, 3); 42

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

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda

More information

G52CPP C++ Programming Lecture 20

G52CPP C++ Programming Lecture 20 G52CPP C++ Programming Lecture 20 Dr Jason Atkin http://www.cs.nott.ac.uk/~jaa/cpp/ g52cpp.html 1 Wrapping up Slicing Problem Smart pointers More C++ things Exams 2 The slicing problem 3 Objects are not

More information

CS 4390 Computer Networks. Transport Services and Protocols

CS 4390 Computer Networks. Transport Services and Protocols CS 4390 Computer Networks UT D data Session 07 Transport Layer Overview and UDP Adapted from Computer Networking a Top-Down Approach 1996-2012 by J.F Kurose and K.W. Ross, All Rights Reserved Transport

More information

Different Layers Lecture 20

Different Layers Lecture 20 Different Layers Lecture 20 10/15/2003 Jian Ren 1 The Network Layer 10/15/2003 Jian Ren 2 Network Layer Functions Transport packet from sending to receiving hosts Network layer protocols in every host,

More information

The C++ Object Lifecycle. EECS 211 Winter 2019

The C++ Object Lifecycle. EECS 211 Winter 2019 The C++ Object Lifecycle EECS 211 Winter 2019 2 Initial code setup $ cd eecs211 $ curl $URL211/lec/09lifecycle.tgz tar zx $ cd 09lifecycle 3 Road map Owned string type concept Faking it An owned string

More information

Indirect Communication

Indirect Communication Indirect Communication Today l Space and time (un)coupling l Group communication, pub/sub, message queues and shared memory Next time l Distributed file systems xkdc Indirect communication " Indirect communication

More information

CHAPTER-2 IP CONCEPTS

CHAPTER-2 IP CONCEPTS CHAPTER-2 IP CONCEPTS Page: 1 IP Concepts IP is a very important protocol in modern internetworking; you can't really comprehend modern networking without a good understanding of IP. Unfortunately, IP

More information

Crash Course in Java. Why Java? Java notes for C++ programmers. Network Programming in Java is very different than in C/C++

Crash Course in Java. Why Java? Java notes for C++ programmers. Network Programming in Java is very different than in C/C++ Crash Course in Java Netprog: Java Intro 1 Why Java? Network Programming in Java is very different than in C/C++ much more language support error handling no pointers! (garbage collection) Threads are

More information

CSE 374 Programming Concepts & Tools. Hal Perkins Spring 2010

CSE 374 Programming Concepts & Tools. Hal Perkins Spring 2010 CSE 374 Programming Concepts & Tools Hal Perkins Spring 2010 Lecture 19 Introduction ti to C++ C++ C++ is an enormous language: g All of C Classes and objects (kind of like Java, some crucial differences)

More information

06/02/ Local & Metropolitan Area Networks 0. INTRODUCTION. 1. History and Future of TCP/IP ACOE322

06/02/ Local & Metropolitan Area Networks 0. INTRODUCTION. 1. History and Future of TCP/IP ACOE322 1 Local & Metropolitan Area Networks ACOE322 Lecture 5 TCP/IP Protocol suite and IP addressing 1 0. INTRODUCTION We shall cover in this topic: 1. The relation of TCP/IP with internet and OSI model 2. Internet

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

CS121/IS223. Object Reference Variables. Dr Olly Gotel

CS121/IS223. Object Reference Variables. Dr Olly Gotel CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors CS121/IS223

More information

Networking Technologies and Applications

Networking Technologies and Applications Networking Technologies and Applications Rolland Vida BME TMIT Transport Protocols UDP User Datagram Protocol TCP Transport Control Protocol and many others UDP One of the core transport protocols Used

More information

Chapter 17 vector and Free Store

Chapter 17 vector and Free Store Chapter 17 vector and Free Store Bjarne Stroustrup www.stroustrup.com/programming Overview Vector revisited How are they implemented? Pointers and free store Allocation (new) Access Arrays and subscripting:

More information

Recap: Pointers. int* int& *p &i &*&* ** * * * * IFMP 18, M. Schwerhoff

Recap: Pointers. int* int& *p &i &*&* ** * * * * IFMP 18, M. Schwerhoff Recap: Pointers IFMP 18, M. Schwerhoff int* int& *p &i &*&* ** * * * * A 0 A 1 A 2 A 3 A 4 A 5 A 0 A 1 A 2 A 3 A 4 A 5 5 i int* p; A 0 A 1 A 2 A 3 A 4 A 5 5 i p int* p; p = &i; A 0 A 1 A 2 A 3 A 4 A 5

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

Discussion: Messaging

Discussion: Messaging Discussion: Messaging Michael Welzl TAPS @ IETF 98 Chicago, 28.3.2017 1 From draft-gjessing-taps-minset-04 Transport features that require app knowledge + allow fall-back to TCP Sending Reliably transfer

More information

The User Datagram Protocol

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

More information

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

UDP CONNECT TO A SERVER

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

More information

Overview. Exercise 0: Implementing a Client. Setup and Preparation

Overview. Exercise 0: Implementing a Client. Setup and Preparation Overview This Lab assignment is similar to the previous one, in that you will be implementing a simple clientserver protocol. There are several differences, however. This time you will use the SOCK_DGRAM

More information

Outline. Option Types. Socket Options SWE 545. Socket Options. Out-of-Band Data. Advanced Socket. Many socket options are Boolean flags

Outline. Option Types. Socket Options SWE 545. Socket Options. Out-of-Band Data. Advanced Socket. Many socket options are Boolean flags Outline SWE 545 Socket Options POSIX name/address conversion Out-of-Band Data Advanced Socket Programming 2 Socket Options Various attributes that are used to determine the behavior of sockets Setting

More information

ECE 435 Network Engineering Lecture 15

ECE 435 Network Engineering Lecture 15 ECE 435 Network Engineering Lecture 15 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 26 October 2016 Announcements HW#5 due HW#6 posted Broadcasts on the MBONE 1 The Transport

More information

Data Structures and Algorithms for Engineers

Data Structures and Algorithms for Engineers 04-630 Data Structures and Algorithms for Engineers David Vernon Carnegie Mellon University Africa vernon@cmu.edu www.vernon.eu Data Structures and Algorithms for Engineers 1 Carnegie Mellon University

More information

QUIZ Friends class Y;

QUIZ Friends class Y; QUIZ Friends class Y; Is a forward declaration neeed here? QUIZ Friends QUIZ Friends - CONCLUSION Forward (a.k.a. incomplete) declarations are needed only when we declare member functions as friends. They

More information

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

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

More information

SERIOUS ABOUT SOFTWARE. Qt Core features. Timo Strömmer, May 26,

SERIOUS ABOUT SOFTWARE. Qt Core features. Timo Strömmer, May 26, SERIOUS ABOUT SOFTWARE Qt Core features Timo Strömmer, May 26, 2010 1 Contents C++ refresher Core features Object model Signals & slots Event loop Shared data Strings Containers Private implementation

More information

Asynchronous Events on Linux

Asynchronous Events on Linux Asynchronous Events on Linux Frederic.Rossi@Ericsson.CA Open System Lab Systems Research June 25, 2002 Ericsson Research Canada Introduction Linux performs well as a general purpose OS but doesn t satisfy

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

CS 351 Week 15. Course Review

CS 351 Week 15. Course Review CS 351 Week 15 Course Review Objectives: 1. To review the contents from different weeks. 2. To have a complete understanding of important concepts from different weeks. Concepts: 1. Important Concepts

More information

Data Structures and Algorithms for Engineers

Data Structures and Algorithms for Engineers 04-630 Data Structures and Algorithms for Engineers David Vernon Carnegie Mellon University Africa vernon@cmu.edu www.vernon.eu Data Structures and Algorithms for Engineers 1 Carnegie Mellon University

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

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 2016 Some slides from Kurose and Ross, Computer Networking, 5 th Edition Presentation 2 Security/Privacy Presentations Nov 3 rd, Nov 10 th, Nov 15 th Upload slides to Canvas by midnight

More information

05-01 Discussion Notes

05-01 Discussion Notes 05-01 Discussion Notes PIC 10B Spring 2018 1 Exceptions 1.1 Introduction Exceptions are used to signify that a function is being used incorrectly. Once an exception is thrown, it is up to the programmer

More information

Lecture 8: Other IPC Mechanisms. CSC 469H1F Fall 2006 Angela Demke Brown

Lecture 8: Other IPC Mechanisms. CSC 469H1F Fall 2006 Angela Demke Brown Lecture 8: Other IPC Mechanisms CSC 469H1F Fall 2006 Angela Demke Brown Topics Messages through sockets / pipes Receiving notification of activity Generalizing the event notification mechanism Kqueue Semaphores

More information

Outline. Interprocess Communication. Interprocess Communication. Communication Models: Message Passing and shared Memory.

Outline. Interprocess Communication. Interprocess Communication. Communication Models: Message Passing and shared Memory. Eike Ritter 1 Modified: October 29, 2012 Lecture 14: Operating Systems with C/C++ School of Computer Science, University of Birmingham, UK Outline 1 2 3 Shared Memory in POSIX systems 1 Based on material

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

Topics. Lecture 8: Other IPC Mechanisms. Socket IPC. Unix Communication

Topics. Lecture 8: Other IPC Mechanisms. Socket IPC. Unix Communication Topics Lecture 8: Other IPC Mechanisms CSC 469H1F Fall 2006 Angela Demke Brown Messages through sockets / pipes Receiving notification of activity Generalizing the event notification mechanism Kqueue Semaphores

More information

CSCI-1200 Data Structures Spring 2014 Lecture 5 Pointers, Arrays, Pointer Arithmetic

CSCI-1200 Data Structures Spring 2014 Lecture 5 Pointers, Arrays, Pointer Arithmetic CSCI-1200 Data Structures Spring 2014 Lecture 5 Pointers, Arrays, Pointer Arithmetic Announcements: Test 1 Information Test 1 will be held Monday, February 10th, 2014 from 6-7:50pm, Lab sections 1-5 and

More information

Peer to Peer Instant Messaging

Peer to Peer Instant Messaging Peer to Peer Instant Messaging Assignment in Data communication I, Department of Information Technology, Uppsala University. Overview In this programming exercise you will implement a peer to peer instant

More information

Chapter 17 vector and Free Store. Bjarne Stroustrup

Chapter 17 vector and Free Store. Bjarne Stroustrup Chapter 17 vector and Free Store Bjarne Stroustrup www.stroustrup.com/programming Overview Vector revisited How are they implemented? Pointers and free store Allocation (new) Access Arrays and subscripting:

More information

New Communication Standard Takyon Proposal Overview

New Communication Standard Takyon Proposal Overview Khronos Group Inc. 2018 - Page 1 Heterogenous Communications Exploratory Group New Communication Standard Takyon Proposal Overview November 2018 Khronos Group Inc. 2018 - Page 2 Khronos Exploratory Group

More information

Motivation of VPN! Overview! VPN addressing and routing! Two basic techniques for VPN! ! How to guarantee privacy of network traffic?!

Motivation of VPN! Overview! VPN addressing and routing! Two basic techniques for VPN! ! How to guarantee privacy of network traffic?! Overview!! Last Lecture!! Daemon processes and advanced I/O functions!! This Lecture!! VPN, NAT, DHCP!! Source: Chapters 19&22 of Comer s book!! Unix domain protocols and non-blocking I/O!! Source: Chapters

More information

CSCI 262 Data Structures. Arrays and Pointers. Arrays. Arrays and Pointers 2/6/2018 POINTER ARITHMETIC

CSCI 262 Data Structures. Arrays and Pointers. Arrays. Arrays and Pointers 2/6/2018 POINTER ARITHMETIC CSCI 262 Data Structures 9 Dynamically Allocated Memory POINTERS AND ARRAYS 2 Arrays Arrays are just sequential chunks of memory: Arrays and Pointers Array variables are secretly pointers: x19 x18 x17

More information

Indirect Communication

Indirect Communication Indirect Communication To do q Today q q Space and time (un)coupling Common techniques q Next time: Overlay networks xkdc Direct coupling communication With R-R, RPC, RMI Space coupled Sender knows the

More information

Chapter 17 vector and Free Store

Chapter 17 vector and Free Store Chapter 17 vector and Free Store Hartmut Kaiser hkaiser@cct.lsu.edu http://www.cct.lsu.edu/~hkaiser/fall_2010/csc1253.html Slides adapted from: Bjarne Stroustrup, Programming Principles and Practice using

More information

Overview. Exercise 0: Implementing a Client. Setup and Preparation

Overview. Exercise 0: Implementing a Client. Setup and Preparation Overview This Lab assignment is similar to the previous one, in that you will be implementing a simple client server protocol. There are several differences, however. This time you will use the SOCK_DGRAM

More information

CSE 333 Midterm Exam July 24, Name UW ID#

CSE 333 Midterm Exam July 24, Name UW ID# Name UW ID# There are 6 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,

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

CA341 - Comparative Programming Languages

CA341 - Comparative Programming Languages CA341 - Comparative Programming Languages David Sinclair Dynamic Data Structures Generally we do not know how much data a program will have to process. There are 2 ways to handle this: Create a fixed data

More information

G52CPP C++ Programming Lecture 14. Dr Jason Atkin

G52CPP C++ Programming Lecture 14. Dr Jason Atkin G52CPP C++ Programming Lecture 14 Dr Jason Atkin 1 Last Lecture Automatically created methods: A default constructor so that objects can be created without defining a constructor A copy constructor used

More information

cs3157: another C lecture (mon-21-feb-2005) C pre-processor (3).

cs3157: another C lecture (mon-21-feb-2005) C pre-processor (3). cs3157: another C lecture (mon-21-feb-2005) C pre-processor (1). today: C pre-processor command-line arguments more on data types and operators: booleans in C logical and bitwise operators type conversion

More information

CS113: Lecture 7. Topics: The C Preprocessor. I/O, Streams, Files

CS113: Lecture 7. Topics: The C Preprocessor. I/O, Streams, Files CS113: Lecture 7 Topics: The C Preprocessor I/O, Streams, Files 1 Remember the name: Pre-processor Most commonly used features: #include, #define. Think of the preprocessor as processing the file so as

More information

Discussion 1E. Jie(Jay) Wang Week 10 Dec.2

Discussion 1E. Jie(Jay) Wang Week 10 Dec.2 Discussion 1E Jie(Jay) Wang Week 10 Dec.2 Outline Dynamic memory allocation Class Final Review Dynamic Allocation of Memory Recall int len = 100; double arr[len]; // error! What if I need to compute the

More information

Object-Oriented Principles and Practice / C++

Object-Oriented Principles and Practice / C++ Object-Oriented Principles and Practice / C++ Alice E. Fischer September 26, 2016 OOPP / C++ Lecture 4... 1/33 Global vs. Class Static Parameters Move Semantics OOPP / C++ Lecture 4... 2/33 Global Functions

More information

Reminder: compiling & linking

Reminder: compiling & linking Reminder: compiling & linking source file 1 object file 1 source file 2 compilation object file 2 library object file 1 linking (relocation + linking) load file source file N object file N library object

More information

C++ Crash Kurs. Exceptions. Dr. Dennis Pfisterer Institut für Telematik, Universität zu Lübeck

C++ Crash Kurs. Exceptions. Dr. Dennis Pfisterer Institut für Telematik, Universität zu Lübeck C++ Crash Kurs Exceptions Dr. Dennis Pfisterer Institut für Telematik, Universität zu Lübeck http://www.itm.uni-luebeck.de/people/pfisterer C++ Exceptions: Introduction What are exceptions Exceptions are

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

Programming with MPI

Programming with MPI Programming with MPI p. 1/?? Programming with MPI Miscellaneous Guidelines Nick Maclaren Computing Service nmm1@cam.ac.uk, ext. 34761 March 2010 Programming with MPI p. 2/?? Summary This is a miscellaneous

More information

Communications API. TEAM A : Communications and Integration Group. April 15, 1995

Communications API. TEAM A : Communications and Integration Group. April 15, 1995 Communications API TEAM A : Communications and Integration Group April 15, 1995 1 Introduction This document specifies the API provided by the Communications and Integration group for use in the AMC system.

More information

Lecture 14: more class, C++ streams

Lecture 14: more class, C++ streams CIS 330: / / / / (_) / / / / _/_/ / / / / / \/ / /_/ / `/ \/ / / / _/_// / / / / /_ / /_/ / / / / /> < / /_/ / / / / /_/ / / / /_/ / / / / / \ /_/ /_/_/_/ _ \,_/_/ /_/\,_/ \ /_/ \ //_/ /_/ Lecture 14:

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

Lecture 9: Transpor Layer Overview and UDP

Lecture 9: Transpor Layer Overview and UDP Lecture 9: Transpor Layer Overview and UDP COMP 332, Spring 2018 Victoria Manfredi Acknowledgements: materials adapted from Computer Networking: A Top Down Approach 7 th edition: 1996-2016, J.F Kurose

More information

CS11 Intro C++ Spring 2018 Lecture 3

CS11 Intro C++ Spring 2018 Lecture 3 CS11 Intro C++ Spring 2018 Lecture 3 C++ File I/O We have already seen C++ stream I/O #include cout > name; cout

More information

ET4254 Communications and Networking 1

ET4254 Communications and Networking 1 Topic 9 Internet Protocols Aims:- basic protocol functions internetworking principles connectionless internetworking IP IPv6 IPSec 1 Protocol Functions have a small set of functions that form basis of

More information

Randall Stewart, Cisco Systems Phill Conrad, University of Delaware

Randall Stewart, Cisco Systems Phill Conrad, University of Delaware SCTP: An Overview Randall Stewart, Cisco Systems Phill Conrad, University of Delaware 1 Our Objectives Be able to explain what SCTP is, and what its major features are when and why you might use it (instead

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files ... and systems programming C basic syntax functions arrays structs

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs. CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files... and systems programming C basic syntax functions arrays structs

More information

vector and Free Store

vector and Free Store vector and Free Store Abstract Vector is not just the most useful standard container, it is also provides examples of some of the most important/powerful/interesting implementation techniques. In this

More information

INTRODUCTORY COMPUTER

INTRODUCTORY COMPUTER INTRODUCTORY COMPUTER NETWORKS TYPES OF NETWORKS Faramarz Hendessi Introductory Computer Networks Lecture 4 Fall 2010 Isfahan University of technology Dr. Faramarz Hendessi 2 Types of Networks Circuit

More information

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI Remote Invocation Today l Request-reply, RPC, RMI Next time l Overlay networks and P2P Types of communication " Persistent or transient Persistent A submitted message is stored until delivered Transient

More information

IEMS 5780 / IERG 4080 Building and Deploying Scalable Machine Learning Services

IEMS 5780 / IERG 4080 Building and Deploying Scalable Machine Learning Services IEMS 5780 / IERG 4080 Building and Deploying Scalable Machine Learning Services Lecture 7 - Network Programming Albert Au Yeung 18th October, 2018 1 / 48 Computer Networking 2 / 48 Data Communication Exchange

More information

ACE Connection Interface Specification Version 0.9

ACE Connection Interface Specification Version 0.9 The University of Kansas Technical Report ACE Connection Interface Specification Version 0.9 James Mauro, Leon Searl, and Gary Minden ITTC-FY2001-TR-23150-07 January 2001 Project Sponsor: U.S. Air Force

More information