CS 6401 Introduction to Computer Networks 09/21/2010 Outline - UNIX sockets - A simple client-server program - Project 1 - LAN bridges and learning.

Slides:



Advertisements
Similar presentations
Sockets: Network IPC Internet Socket UNIX Domain Socket.
Advertisements

CCNA – Network Fundamentals
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Socket Programming 0.
CSE 534 Fundamentals of Computer Networks Lecture 4: Bridging (From Hub to Switch by Way of Tree) Based on slides from D. Choffnes Northeastern U. Revised.
CS 4700 / CS 5700 Network Fundamentals Lecture 7: Bridging (From Hub to Switch by Way of Tree) Revised 1/14/13.
Spring 2003CS 4611 Introduction, Continued COS 461.
Socket Programming Application Programming Interface.
Networks: TCP/IP Socket Calls1 Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Socket Programming.
Tutorial 8 Socket Programming
CSE/EE 461 Getting Started with Networking. Basic Concepts  A PROCESS is an executing program somewhere.  Eg, “./a.out”  A MESSAGE contains information.
Introduction to Computer Networks 09/23 Presenter: Fatemah Panahi.
Chapter 26 Client Server Interaction Communication across a computer network requires a pair of application programs to cooperate. One application on one.
UNIX Sockets COS 461 Precept 1. Clients and Servers Client program – Running on end host – Requests service – E.g., Web browser Server program – Running.
UNIX Sockets COS 461 Precept 1.
Sockets CIS 370 Fall 2009, UMassD. Introduction  Sockets provide a simple programming interface which is consistent for processes on the same machine.
Fall 2009COSC 6501 Welcome to COSC650 Towson University Yanggon Kim.
ECE 4110 – Internetwork Programming Client-Server Model.
Fall 2000Datacom 11 Lecture 4 Socket Interface Programming: Service Interface between Applications and TCP.
Elementary TCP Sockets
Socket Programming. Introduction Sockets are a protocol independent method of creating a connection between processes. Sockets can be either – Connection.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
9/12/2015B.R1 Socket Abstraction and Interprocess Communication B.Ramamurthy CSE421.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
Sockets CIS 370 Lab 10 UMass Dartmouth. Introduction 4 Sockets provide a simple programming interface which is consistent for processes on the same machine.
Common Devices Used In Computer Networks
CS 640: Introduction to Computer Networks
Server Sockets: A server socket listens on a given port Many different clients may be connecting to that port Ideally, you would like a separate file descriptor.
Chapter 2 Applications and Layered Architectures Sockets.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
Remote Shell CS230 Project #4 Assigned : Due date :
CS 158A1 1.4 Implementing Network Software Phenomenal success of the Internet: – Computer # connected doubled every year since 1981, now approaching 200.
CPSC 441 TUTORIAL – FEB 13, 2012 TA: RUITNG ZHOU UDP REVIEW.
1 Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Lecture 3: Sockets.
Distributed Computing A Programmer’s Perspective.
UNIX Sockets COS 461 Precept 1. Socket and Process Communication The interface that the OS provides to its networking subsystem application layer transport.
CSE 331: Introduction to Networks and Security Fall 2000 Instructor: Carl A. Gunter Slide Set 5.
Spring 2002CS 4611 Introduction Outline Statistical Multiplexing Inter-Process Communication Network Architecture Performance Metrics Implementation Issues.
CSE/EE 461 Getting Started with Networking. 2 Basic Concepts A PROCESS is an executing program somewhere. –Eg, “./a.out” A MESSAGE contains information.
Chapter 27 Socket API Interface The interface between an application program and the communication protocols in an operating system is known as the Application.
Socket Programming Lab 1 1CS Computer Networks.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
Socket Programming.
CSCI 330 UNIX and Network Programming Unit XV: Transmission Control Protocol.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: HsinYu Ha.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service.
Read() recv() connection establishment Server (connection-oriented protocol) blocks until connection from client Client socket() bind() listen() accept()
1 Introduction Outline Statistical Multiplexing Inter-Process Communication Network Architecture Performance Metrics Implementation Issues.
CSCI 330 UNIX and Network Programming Unit XIV: User Datagram Protocol.
Socket Programming. Computer Science, FSU2 Interprocess Communication Within a single system – Pipes, FIFOs – Message Queues – Semaphores, Shared Memory.
UNIX Sockets Outline UNIX sockets CS 640.
1 Spring Semester 2008, Dept. of Computer Science, Technion Internet Networking recitation #7 Socket Programming.
1 Kyung Hee University Chapter 11 User Datagram Protocol.
1 LAN switching and Bridges Relates to Lab Outline Interconnection devices Bridges/LAN switches vs. Routers Bridges Learning Bridges Transparent.
Lecture 3 TCP and UDP Sockets CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
1 Socket Interface. 2 Client-Server Architecture The client is the one who speaks first Typical client-server situations  Client and server on the same.
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
Sockets and Beginning Network Programming
UNIX Sockets COS 461 Precept 1.
Socket Programming in C
Socket Interface 1 Introduction 11 Socket address formats 2 API 12 13
Interacting With Protocol Software
Transport layer API: Socket Programming
UNIX Sockets Outline Homework #1 posted by end of day
Socket Programming in C
Socket Programming Neil Tang 09/08/2008
Internet Networking recitation #8
Sockets.
Presentation transcript:

CS 6401 Introduction to Computer Networks 09/21/2010 Outline - UNIX sockets - A simple client-server program - Project 1 - LAN bridges and learning

CS 6402 Berkeley Sockets Networking protocols are implemented as part of the OS –The networking API exported by most OS’s is the socket interface –Originally provided by BSD 4.1c ~1982. The principal abstraction is a socket –Point at which an application attaches to the network –Defines operations for creating connections, attaching to network, sending/receiving data, closing.

CS 6403 Connection-oriented example (TCP) Server Socket() Bind() Client Socket() Listen() Accept() Recv() Send() Connect() Send() Recv() Block until connect Process request Connection Establishmt. Data (request) Data (reply)

CS 6404 Connectionless example (UDP) Server Socket() Bind() Client Socket() Recvfrom() Sendto() Bind() Sendto() Recvfrom() Block until Data from client Process request Data (request) Data (reply)

CS 6405 Socket call Means by which an application attached to the network int socket(int family, int type, int protocol) Family: address family (protocol family) –AF_UNIX, AF_INET, AF_NS, AF_IMPLINK Type: semantics of communication –SOCK_STREAM, SOCK_DGRAM, SOCK_RAW –Not all combinations of family and type are valid Protocol: Usually set to 0 but can be set to specific value. –Family and type usually imply the protocol Return value is a handle for new socket

CS 6406 Bind call Binds a newly created socket to the specified address Int bind(int socket, struct sockaddr *address, int addr_len) Socket: newly created socket handle Address: data structure of address of local system –IP address and port number (demux keys) –Same operation for both connection-oriented and connectionless servers Can use well known port or unique port

CS 6407 Listen call Used by connection-oriented servers to indicate an application is willing to receive connections Int(int socket, int backlog) Socket: handle of newly creates socket Backlog: number of connection requests that can be queued by the system while waiting for server to execute accept call.

CS 6408 Accept call After executing listen, the accept call carries out a passive open (server prepared to accept connects). Int accept(int socket, struct sockaddr *address, int addr_len) It blocks until a remote client carries out a connection request. When it does return, it returns with a new socket that corresponds with new connection and the address contains the clients address

CS 6409 Connect call Client executes an active open of a connection Int connect(int socket, struct sockaddr *address, int addr_len) Call does not return until the three-way handshake (TCP) is complete Address field contains remote system’s address Client OS usually selects random, unused port

CS Send(to), Recv(from) After connection has been made, application uses send/recv to data Int send(int socket, char *message, int msg_len, int flags) –Send specified message using specified socket Int recv(int scoket, char *buffer, int buf_len, int flags) –Receive message from specified socket into specified buffer

CS Socket Implimentation Protocol implementation –Process per protocol Use a separate process to implement each protocol Messages are passes between processes –Process per message Use one process to handle each message/communication Generally more efficient Buffer use –Applications use buffers as do protocols Copies are VERY expensive Message abstraction enables pointers to be used and minimal copies

CS Practical issues – using sockets You have to be very careful when using these calls –Specific data structures and formats –Ports cannot be less than 1024 You can use other tools to see if things are working –Tcpdump –/proc –netstat Client and server can be on same system Think about error handling methods

CS 64013CS Switches and Learning Outline Why bridges (old name for switches)? Example of Layer 2 forwarding How do bridges build their forwarding tables?

CS LAN Properties Exploit physical proximity. –Often a limitation on the physical distance –E.g. to detect collisions in a contention based network Relies on single administrative control and some level of trust. –Broadcasting packets to everybody and hoping everybody (other than the receiver) will ignore the packet Broadcast: nodes can send messages that can be heard by all nodes on the network. –Almost essential for network administration –Can also be used for applications, e.g. video conferencing But broadcast fundamentally does not scale.

CS Building Larger LANs: Bridges Hubs are physical level devices –Don’t isolate collision domains  broadcast issues At layer 2, bridges connect multiple IEEE 802 LANs –BRIDGE is just an old name for a switch –Separate a single LAN into multiple smaller collision domains Reduce collision domain size host Bridge

CS Basic Bridge Functionality Bridges are full fledged packet switches Frame comes in on an interface –Switch looks at destination LAN address –Determines port on which host connected –Only forward packets to the right port –Must run CSMA/CD with hosts connected to same LAN Also between bridge and host connected to a LAN

CS Bridges provide “transparent” functionality Design features: –“Plug and play” capability –Self-configuring without hardware or software changes –Bridge do not impact the operation of the individual LANs Three components of transparent bridges: 1)Forwarding of frames 2)Learning of addresses 3)Spanning tree algorithm

CS Address Lookup/Forwarding Example Address is a 48 bit IEEE MAC address. Next hop: output port for packet Timer is used to flush old entries Size of the table is equal to the number of hosts Flat address  no aggregation No entry  packets are broadcasted Bridge 8711C98900AA 2 AddressNext Hop A21032C9A A323C B C :15 Info 8:36 8:01 8:16 8:

CS Learning Bridge tables can be filled in manually (flush out old entries etc) –Time consuming, error-prone –Self-configuring preferred Bridges use “learning”  crucial to their transparent functioning Keep track of source address of packet (S) and the arriving interface (I). –Fill in the forwarding table based on this information –Packet with destination address S must be sent to interface I! host Bridge