Internet and Intranet Protocols and Applications

Slides:



Advertisements
Similar presentations
Socket Programming Application Programming Interface.
Advertisements

Sockets Programming CS144 Review Session 1 April 4, 2008 Ben Nham.
Socket Programming: a Primer Socket to me!. Feb. 23, 2001EE122, UCB2 Why does one need sockets? application network protocol sockets network.
EECS122 Communications Networks Socket Programming January 30th, 2003 Jörn Altmann.
Client Design. Issues Server Identification Setting up a socket on client side TCP –Reading and writing with a socket –Closing a socket UDP –Reading and.
תקשורת באינטרנט Tutorial 8. 2 n Socket programming u What is socket ? u Sockets architecture u Types of Sockets u The Socket system calls u Data Transfer.
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.
Socket Addresses. Domains Internet domains –familiar with these Unix domains –for processes communicating on the same hosts –not sure of widespread use.
SOCKETS Lecture #3. The Socket Interface Funded by ARPA (Advanced Research Projects Agency) in Developed at UC Berkeley Objective: to transport.
UNIX Sockets COS 461 Precept 1. Clients and Servers Client program – Running on end host – Requests service – E.g., Web browser Server program – Running.
1 Tutorial on Socket Programming Computer Networks - CSC 458 Department of Computer Science Yukun Zhu (Slides are mainly from Monia Ghobadi, and Amin Tootoonchian,
Cs423-cotter1 Example Client Program Reference Comer & Stevens, Chapter 7.
Socket programming in C. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
Fall 2000Datacom 11 Socket Programming Review Examples: Client and Server-Diagnostics UDP versus TCP Echo.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Socket Programming. Introduction Sockets are a protocol independent method of creating a connection between processes. Sockets can be either – Connection.
CSTP FS01CS423 (cotter)1 Protocols 2 References: RFC’s 791, 793, 768, 826.
The Application Layer Application Services (Telnet, FTP, , WWW) Reliable Stream Transport (TCP) Connectionless Packet Delivery Service (IP) Unreliable.
 Wind River Systems, Inc Chapter - 13 Network Programming.
Socket Programming Lec 2 Rishi Kant. Review of Socket programming Decide which type of socket – stream or datagram. Based on type create socket using.
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.
Socket Programming Lab 1 1CS Computer Networks.
1 Client-Server Interaction. 2 Functionality Transport layer and layers below –Basic communication –Reliability Application layer –Abstractions Files.
Sockets Socket = abstraction of the port concept: –Application programs request that the operating system create a socket when one is needed –O.S. returns.
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,
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.
UNIX Sockets Outline UNIX sockets CS 640.
The Socket Interface A Networking Application Program Interface.
Netprog: Client/Server Issues1 Issues in Client/Server Programming Refs: Chapter 27.
Lecture 15 Socket Programming CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Socket programming in C. Socket programming with TCP Client must contact server server process must first be running server must have created socket (door)
Socket Programming in C CS587x Lecture 3 Department of Computer Science Iowa State University.
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
SOCKET PROGRAMMING Presented By : Divya Sharma.
Sockets and Beginning Network Programming
Socket programming in C
CS 1652 Jack Lange University of Pittsburgh
Introduction to Information Security
Socket Programming in C
Tutorial on Socket Programming
Client-Server Interaction
Transport layer API: Socket Programming
The Transport Layer Socket Programming
Things that are nice to know when you’re doing this project
Client-side Networking CSE 333 Spring 2018
The University of Adelaide, School of Computer Science
The University of Adelaide, School of Computer Science
Berkeley API Socket Programming
The University of Adelaide, School of Computer Science
Berkeley API Socket Programming
Chapter 2: Application layer
Issues in Client/Server Programming
Client-side Networking CSE 333 Summer 2018
CS3516 — TCP/IP Socket Programming
Socket Programming(1/2)
Sockets Programming Socket to me!.
Sockets Programming Socket to me!.
Socket Programming Neil Tang 09/08/2008
Berkeley API Socket Programming
in unistd.h: int gethostname(char * name, int maxlen)
Process-to-Process Delivery: UDP, TCP
Sockets.
The University of Adelaide, School of Computer Science
The University of Adelaide, School of Computer Science
Socket programming in C
Presentation transcript:

Internet and Intranet Protocols and Applications Lecture 3: Network Programming Feb 8, 2000 Arthur P. Goldberg Computer Science Department New York University artg@cs.nyu.edu

Client/Server Paradigm Basis for most application layer communications Client (typically) Initiates communication Sends requests and receives responses Interacts with just a few servers at a time Server (typically) Waits for incoming requests Receives requests and sends responses Interacts with many clients concurrently 11/28/2018

How do applications use the transport layer? Conceptual operations (Comer 4.3) Allocate local resources for communications Specify local and remote communications endpoints Initiate a connection (client) Wait for an incoming connection (server) Send or receive data Terminate a connection Handle connection termination from the remote site Abort communications Handle error conditions or a connection abort Release local resources when communication finishes 11/28/2018

Design CHOICES for Networking API Assume networking is in the OS Which system calls? Define a new set of networking calls Use existing I/O calls As in Unix and Win32 Which protocols? Specific Generic 11/28/2018

Unix system calls, review 11/28/2018 Comer, Fig 4.2

Network Client System Calls socket_descriptor = socket ( family, type, protocol ); rc = connect ( sd, (& sockaddr_in) addr, addr_len ); rc = write ( sd, (& char) buf, buf_len ); rc = read ( sd, (& char) buf, buf_len ); rc = close ( sd ); rc = shutdown ( sd, direction ); unspecified types are int. 11/28/2018

Addressing IP Port (& hostent) gethostbyname ((& char) name ); rc = gethostname ((& char) name, namelen ); Port (& servent) getservbyname ((& char) name, (& char) name ); 11/28/2018

Minimal TCP Client in C /* BUGS: NO ERROR CHECKING; DESIGN FLAW: NO MODULARITY */ #include "minimal_tcp.h" /* usage: TCP_client domain_name port_num */ void main( int argc, char *argv[] ) { struct hostent *phe; struct protoent *ppe; struct sockaddr_in sin; char c; int j, socket_desc; char hi[] = "hello world\n"; phe = gethostbyname( argv[1] ); memcpy ( &sin.sin_addr, phe->h_addr, phe->h_length ); sin.sin_port = atoi(argv[2]); sin.sin_family = AF_INET; ppe = getprotobyname("tcp"); socket_desc = socket( PF_INET, SOCK_STREAM, ppe->p_proto ); (void) connect( socket_desc, &sin, sizeof(sin) ); (void) write( socket_desc, hi, strlen( hi ) ); for( j = 0; j < strlen( hi ); j++ ) { (void) read( socket_desc, &c, 1 ); putc ( c , stdout ); } (void) close( socket_desc ); 11/28/2018

Minimal TCP Client, include file /* Comer procedure 7.7 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> 11/28/2018

IBQ Assume packets arrive reliably What are these programs’ minimum duration, in round trip delays? What are these programs’ maximum duration? 11/28/2018

Client design issues Parameterize, with respect to host and server Connection-based or connectionless Applications should use TCP unless it Does not need reliability Require broadcast or multi-cast Cannot tolerate TCP’s overhead 11/28/2018

Reasons for New Networking System Calls in the API Greater control over protocol Eg., send data with SYN message Performance Eg., pre-compute checksum for TCP messages 11/28/2018