Socket Addresses. Domains Internet domains –familiar with these Unix domains –for processes communicating on the same hosts –not sure of widespread use.

Slides:



Advertisements
Similar presentations
Sockets Programming Network API Socket Structures Socket Functions
Advertisements

Socket Programming Application Programming Interface.
Data Communications and Networking (Third Edition)
Sockets Programming CS144 Review Session 1 April 4, 2008 Ben Nham.
Networks: TCP/IP Socket Calls1 Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Quick Overview. 2 ISO/OSI Reference Model Application Application Presentation Presentation Session Session Transport Transport Network Network Data Link.
1 Netcomm Sockets Communication Networks Recitation 1.
Sockets Basics Conectionless Protocol. Today IPC Sockets Basic functions Handed code Q & A.
Socket Programming: a Primer Socket to me!. Feb. 23, 2001EE122, UCB2 Why does one need sockets? application network protocol sockets network.
Windows Sockets Purpose Windows Sockets 2 (Winsock) enables programmers to create advanced internet, intranet, and other network-capable applications to.
Tutorial 8 Socket Programming
1 Generic Transport Service Primitives Listen –notify Transport layer a call is expected Connect –establish Transport layer connection Send (or Write)
UDP: User Datagram Protocol. UDP: User Datagram Protocol [RFC 768] r “bare bones”, “best effort” transport protocol r connectionless: m no handshaking.
CS 311 – Lecture 18 Outline IPC via Sockets – Server side socket() bind() accept() listen() – Client side connect() Lecture 181CS Operating Systems.
CSE/EE 461 Getting Started with Networking. Basic Concepts  A PROCESS is an executing program somewhere.  Eg, “./a.out”  A MESSAGE contains information.
1 Tutorial on Socket Programming Computer Networks - CSC 458 Department of Computer Science Yukun Zhu (Slides are mainly from Monia Ghobadi, and Amin Tootoonchian,
Basic Socket Programming TCP/IP overview. TCP interface Reference: –UNIX Network Programming, by Richard Stevens. –UNIX man page.
TCP Socket Programming. r An abstract interface provided to the application programmer  File descriptor, allows apps to read/write to the network r Allows.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Network Programming Tutorial #9 CPSC 261. A socket is one end of a virtual communication channel Provides network connectivity to any other socket anywhere.
Chapter 24 - Socket Interface Introduction API The Socket API Sockets and socket libraries Sockets and UNIX I/O The socket API Summary of socket system.
Sirak Kaewjamnong Computer Network Systems
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.
 Wind River Systems, Inc Chapter - 13 Network Programming.
1 Writing Network Applications using the TCP/IP Protocol Stack: Socket Programming.
Chapter 2 Applications and Layered Architectures Sockets.
The Socket Interface Chapter 22. Introduction This chapter reviews one example of an Application Program Interface (API) which is the interface between.
Remote Shell CS230 Project #4 Assigned : Due date :
The Pocket Guide to TCP/IP Sockets: C Version Michael J. Donahoo Kenneth L. Calvert.
Outline Socket programming with Windows OSSocket programming with Windows OS C++ UDPSocket classC++ UDPSocket class Socket programming with Windows OSSocket.
Networking Tutorial Special Interest Group for Software Engineering Luke Rajlich.
CS 158A1 1.4 Implementing Network Software Phenomenal success of the Internet: – Computer # connected doubled every year since 1981, now approaching 200.
1 Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Lecture 3: Sockets.
The Sockets Library and Concepts Rudra Dutta CSC Spring 2007, Section 001.
TELE202 Lecture 15 Socket programming 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (2) »Source: chapter 17 ¥This Lecture »Socket programming.
Introduction to Socket
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 3.1 Internet Applications Ch. 28,… (Client-Server Concept, Use of Protocol Ports, Socket API)
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 Tutorial Department of Computer Science Southern Illinois University Edwardsville Fall, 2015 Dr. Hiroshi Fujinoki
Socket Programming Lab 1 1CS Computer Networks.
1 Sockets Programming Socket to me!. 2 Network Application Programming Interface (API) The services provided by the operating system that provide the.
Socket Programming.
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
CSCI 330 UNIX and Network Programming Unit XV: Transmission Control Protocol.
Berkeley Socket Abstraction
Network Programming Berkeley Sockets (BSD)
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.
Lecture 15 Socket Programming CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Socket Programming in C CS587x Lecture 3 Department of Computer Science Iowa State University.
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.
Client-Server model. Socket programming 
Sockets and Beginning Network Programming
Jim Fawcett CSE 681 – Software Modeling & Analysis Fall 2002
The Pocket Guide to TCP/IP Sockets: C Version
Week 13 - Friday CS222.
Socket Interface 1 Introduction 11 Socket address formats 2 API 12 13
CSI 4118 – UNIVERSITY OF OTTAWA
Transport layer API: Socket Programming
Chapter 3 Socket API © Bobby Hoggard, Department of Computer Science, East Carolina University These slides may not be used or duplicated without permission.
Sockets Programming Socket to me!.
Sockets Programming Socket to me!.
Internet Networking recitation #8
Sockets.
CSI 4118 – UNIVERSITY OF OTTAWA
Jim Fawcett CSE 681 – Software Modeling & Analysis Summer 2003
Presentation transcript:

Socket Addresses

Domains Internet domains –familiar with these Unix domains –for processes communicating on the same hosts –not sure of widespread use –used to debug internally

Protocol families SNA - IBM Systems Network Architecture UUCP - Unix to Unix copy XNS - Xerox Network System NETBIOS - IBM Basic I/O system TCP/IP ( PF_INET ) UNIX ( PF_UNIX )

Constants for addresses PF_UNIX1 PF_INET2 PF_NS6 (xns) PF_SNA11 PF_DECnet12 PF_APPLETALK16 PF_X2520 …...

Address Formation All Protocols do not agree Socket Abstraction TCP/IP IP Address Protocol Port Unix socket Other Protocols Address format may be different Built to support multiple protocols

Address Families Socket abstraction has a series of address families so that each family can have it’s own format for endpoint addresses. TCP/IP has address family named AF_INET TCP/IP also has a protocol family : PF_INET Both have numeric value 2 which leads to further confusion.. They can be switched at will with no apparent consequence.

Generic Address (address family, endpoint address in family) socket API defines one to use as a general address, but it won’t work for everything Works for TCP/IP not Unix struct sockaddr { u_short sa_family; char sa_data[14]; }; E.g. Unix sockets (internal) use a named pipe for the endpoint and the length of it is comparable to a path/file name (much longer)

What TCP/IP uses for an address 2 byte address family (AF_INET) 2 byte port number 4 byte IP address 8 bytes unused struct sock_addr_in{ u_short sin_family; u_short sin_port; struct in_addr sin_addr; char sin_zero[8] } TCP/IP apps need not use sockaddr Use sockaddr_in

Procedures in API

socket () Purpose: create a socket for communications Returns: descriptor for a new socket Arguments: –protocol family PF_INET –type of service stream (TCP) datagram (UDP)

connect() Purpose: establish the connection Returns: success/failure Arguments: –remote endpoint

send() Purpose: send data through to other end Returns: success/failure Arguments: –socket descriptor –address –length of data –control directives

recv() Purpose: get response Returns: message received Arguments: –socket descriptor –address of buffer –length of buffer –control bits NOTE - recv is limited to buffer space and will cut off if necessary. Must go back

recv() (UDP) Works similarly If too much data: – truncated at the size of the receive buffer –discard remainder –return error condition

closesocket() Purpose: give socket resource back to OS if shared with other processes, reference count decremented (until 0). Returns: message received Arguments: –socket descriptor –address of buffer –length of buffer –control bits

bind() Purpose: specify local endpoint address Returns: message received Arguments: –socket descriptor –endpoint address ( sockaddr_in for TCP/IP) IP address port

listen() Purpose: put socket in passive mode and specify size of queue for incoming requests Returns: success/fail Arguments: –socket descriptor –size of queue

accept() Purpose: wait for next incoming request Returns: new socket for interaction Arguments: –socket descriptor

Windows client-server usage CLIENT WSAStartup socket connect send recv closesocket WSACleanUP SERVER WSAStartup socket bind listen accept recv send closesocket WSACleanup