DOC PREVIEW
UW-Madison CS 640 - Lecture Notes

This preview shows page 1-2-3-4-5-6 out of 19 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 19 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Introduction to Computer Networks 09/21/2010Berkeley SocketsConnection-oriented example (TCP)Connectionless example (UDP)Socket callBind callListen callAccept callConnect callSend(to), Recv(from)Socket ImplimentationPractical issues – using socketsSwitches and LearningLAN PropertiesBuilding Larger LANs: BridgesBasic Bridge FunctionalityBridges provide “transparent” functionalityAddress Lookup/Forwarding ExampleLearningCS 640 1Introduction to Computer Networks09/21/2010Outline- UNIX sockets- A simple client-server program- Project 1- LAN bridges and learningCS 640 2Berkeley 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 640 3Connection-oriented example (TCP)ServerSocket()Bind()ClientSocket()Listen()Accept()Recv()Send()Connect()Send()Recv()Block untilconnectProcessrequestConnection Establishmt.Data (request)Data (reply)CS 640 4Connectionless example (UDP)ServerSocket()Bind()ClientSocket()Recvfrom()Sendto()Bind()Sendto()Recvfrom()Block untilData from clientProcessrequestData (request)Data (reply)CS 640 5Socket 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 socketCS 640 6Bind 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 portCS 640 7Listen 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 640 8Accept 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 addressCS 640 9Connect 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 portCS 640 10Send(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 bufferCS 640 11Socket 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 copiesCS 640 12Practical 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 methodsCS 640 13CS 640 13Switches and LearningOutline Why bridges (old name for switches)? Example of Layer 2 forwarding How do bridges build their forwarding tables?CS 640 14LAN 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 640 15Building 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 sizehost host host host hosthost host host host hosthosthostBridgeCS 640 16Basic 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 LANCS 640 17Bridges 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 frames2) Learning of addresses3) Spanning tree algorithmCS 640 18Address 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 broadcastedBridge8711C98900AA2Address Next HopA21032C9A591199A323C908422301B2369011C269551900119038:15Info8:368:018:168:11132CS


View Full Document

UW-Madison CS 640 - Lecture Notes

Documents in this Course
Security

Security

21 pages

Mobile IP

Mobile IP

16 pages

Lecture 7

Lecture 7

36 pages

Multicast

Multicast

38 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?