Lecture22-networking-socketprogramming - Some of these...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS 3214 Computer Systems Godmar Back Lecture 22 Some of these slides are substantially derived from slides provided by Jim Kurose & Keith Ross. Copyright on this material is held by Kurose & Ross. Used with permission. The textbook is Computer Networking: A Top Down Approach Featuring the Internet Jim Kurose, Keith Ross, Addison-Wesley, July 2004 NETWORKING Part 2 CS 3214 Fall 2011 Socket Programming UDP & TCP Network Socket Programming Socket: (narrow definition:) a door between application process and end-end-transport protocol (UDP or TCP) controlled by CS 3214 Fall 2011 process Stack w/ buffers, variables socket controlled by application developer controlled by operating system host or server process Stack w/ buffers, variables socket application developer controlled by operating system host or server internet Socket Programming Socket API • introduced in BSD 4.1 UNIX 1981 a host-local , application-created , OScontrolled interface socket CS 3214 Fall 2011 UNIX, 1981 • explicitly created, used, released by apps • used for both local and remote communication OS-controlled interface (a “door”) into which application process can both send and receive messages to/from another application process BSD Socket API • API – Application Programming Interface – Provides access to services – Specified in C language – Implemented on many platforms in one way or the other • (Windows: WinSock2, CSocket MFC classes for BSD-like look) CS 3214 Fall 2011 Sockets (in Unix) are file descriptors – General idea: writing to the socket is sending data to network, reading from socket is receiving data – Good because read(2), write(2), close(2) and others (select(2), poll(2), ioctl(2), SIGIO, fcntl(2)) can be reused – Bad because suggest orthogonality if where there is none • Other languages provide separate mapping, often thin veneers over BSD sockets (e.g., java.net.Socket)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Addressing • For UDP/IP or TCP/IP socket communication, generally need 4 parameters: – Source Identifier (32-bit IPv4 or 128-bit IPv6 Address) – Source Port (16-bit) – Destination Identifier (32-bit IP or 128-bit IPv6 Address) CS 3214 Fall 2011 – Destination Port (16-bit) • Notice that the relationship of “local” and “remote” (also called “peer”) to source/destination depends on direction of communication • Note: – UDP uses only Destination (IP+Port) for demultiplexing – TCP uses Source + Destination • (quadruple: Src IP, Src Port, Dst IP, Dest Port) Addressing in IPv4 • IP address interfaces, not hosts • Sets of interfaces form subnets – Subnets share common prefix CS 3214 Fall 2011 • Route to CIDR-ized subnet addresses – a.b.c.d/x • Within subnet, reach destination directly R2 R1 Internet Ethernet LAN 1
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/31/2011 for the course CS 3214 taught by Professor Staff during the Fall '11 term at Virginia Tech.

Page1 / 5

Lecture22-networking-socketprogramming - Some of these...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online