Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 17 Acknowledgements: The syllabus and power point presentations are modified versions.

Slides:



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

Today’s topic: Basic TCP API –Socket –Bind –Listen –Connect –Accept –Read –Write –Close.
Elementary TCP Sockets Computer Networks Computer Networks Term B10 UNIX Network Programming Vol. 1, Second Ed. Stevens Chapter 4.
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.
CSCE 515: Computer Network Programming Socket Wenyuan Xu Department of Computer Science and Engineering.
Sockets Programming Introduction © Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid.
Tutorial 8 Socket Programming
#include DatatypeDescription int8_t uint8_t int16_t uint16_t int32_t uint32_t Signed 8-bit integer Unsigned 8-bit integer Signed 16-bit integer Unsigned.
CS 311 – Lecture 18 Outline IPC via Sockets – Server side socket() bind() accept() listen() – Client side connect() Lecture 181CS Operating Systems.
Socket Addresses. Domains Internet domains –familiar with these Unix domains –for processes communicating on the same hosts –not sure of widespread use.
Winsock programming.  TCP/IP UDP TCP  Winsock #include wsock32.lib.
Unix Network Programming Part 2: Elementary Sockets Jani Peusaari.
Lecture 10 Overview. Network API Application Programming Interface – Services that provide the interface between application and protocol software often.
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.
ECE453 – Introduction to Computer Networks Lecture 15 – Transport Layer (II)
Operating Systems Chapter 9 Distributed Communication.
Client-Side Network Programming
Zhu Reference: Daniel Spangenberger Computer Networks, Fall 2007 PPT-4 Socket Programming.
CS345 Operating Systems Φροντιστήριο Άσκησης 2. Inter-process communication Exchange data among processes Methods –Signal –Pipe –Sockets.
Introduction to Socket Programming Advisor: Quincy Wu Speaker: Kuan-Ta Lu Date: Nov. 25, 2010.
Technical Details for sockaddr_in Structure Department of Computer Science Southern Illinois University Edwardsville Fall, 2015 Dr. Hiroshi Fujinoki
TELE202 Lecture 15 Socket programming 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (2) »Source: chapter 17 ¥This Lecture »Socket programming.
Lecture 15 Overview.
Introduction to Socket
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.
Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 25 Acknowledgements: The syllabus and power point presentations are modified versions.
Advanced UNIX programming Fall 2002, lecture 16 Instructor: Ashok Srinivasan Acknowledgements: The syllabus and power point presentations are modified.
Socket address structures Byte ordering IP address conversion
Sockets Introduction Socket address structures Value-result arguments
Introduction to Sockets
Socket Programming(2/2) 1. Outline  1. Introduction to Network Programming  2. Network Architecture – Client/Server Model  3. TCP Socket Programming.
Network Programming Berkeley Sockets (BSD)
Read() recv() connection establishment Server (connection-oriented protocol) blocks until connection from client Client socket() bind() listen() accept()
CSCI 330 UNIX and Network Programming Unit XIV: User Datagram Protocol.
In unistd.h : int gethostname(char * name, int maxlen) Purpose : Find the computer's name.
1 Spring Semester 2008, Dept. of Computer Science, Technion Internet Networking recitation #7 Socket Programming.
Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 28 Acknowledgements: The syllabus and power point presentations are modified versions.
Lecture 15 Socket Programming CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Socket Programming(1/2). Outline  1. Introduction to Network Programming  2. Network Architecture – Client/Server Model  3. TCP Socket Programming.
CSE 333 – SECTION 8 Client-Side Network Programming.
CS 3214 Computer Systems.
Onward with Chat! Networking CS 3470, Section 1.
Network Programming CSC- 341
CS 3214 Computer Systems Lecture 22 Godmar Back.
Socket Programming (Cont.)
Network Programming CSC- 341
Network Programming with Sockets
CSI 4118 – UNIVERSITY OF OTTAWA
Chapter 3 Sockets Introduction
Introduction to Socket Programming
TCP/IP Socket Programming in C
Lecture 2 Socket Programming
Advanced UNIX programming
IP Addresses, DNS CSE 333 Summer 2018
Socket Programming(1/2)
Sockets Programming Socket to me!.
Sockets Programming Socket to me!.
Internet Networking recitation #8
in unistd.h: int gethostname(char * name, int maxlen)
Outline Communications in Distributed Systems Socket Programming
Sockets.
Today’s topic: Basic TCP API
CSI 4118 – UNIVERSITY OF OTTAWA
Advanced UNIX programming
Presentation transcript:

Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 17 Acknowledgements: The syllabus and power point presentations are modified versions of those by T. Baker and X. Yuan

Announcements Reading assignment –Chapters 3 and 4 of UNP Collect midterm from me –... during my office hours T 2:15-3:15 pm or W 2:15-3:15 pm If you have questions on HW2 results, meet the grader

Week 7 Topics Basic TCP sockets –Socket address structure –Byte ordering and manipulation functions –socket, connect, bind, listen, accept Client-Server design Concurrent server

Basic TCP sockets Socket address structure Byte ordering and manipulation functions socket, connect, bind, listen, accept

struct in_addr { in_addr_t s_addr; } struct sockaddr_in { uint8_t sin_len; sa_family_t sin_family; in_port_t sin_port; struct in_addr sin_addr; char sin_zero[8]; } –Always use sockaddr_in type for manipulation and convert it to sockaddr See example1.c and example2.c struct sockaddr { uint8_t sa_len; sa_family_t sa_family; char sa_data[14]; } Socket address structure

What happen when we run example2.c as server on program and example1.c as client on linprog? sin_port and sin_addr must be in network byte order Check example3.c – What is the difference between program and linprog? Network byte order

–#include uint16_t htons(uint16_t host16bitvalue); uint32_t htonl(uint32_t host32bitvalue); uint16_t ntohs(uint16_t net16bitvalue); uint32_t ntohl(uint32_t net32bitvalue); –See example3.c Byte ordering functions

–#include void *memset(void *dst, int c, size_t len); void *memcpy(void *dst, void *src, size_t nbytes); void *memcmp(const void *ptr1, const void *ptr2, size_t nbytes); Byte manipulation functions

Address conversion functions #include –in_addr_t inet_addr(const char *cp); –char *inet_ntoa(struct in_addr in); The ones below should be preferred –inet_ntop(address family, source, destination, size); –inet_pton(address family, source, destination);