Advanced Sockets Introduction to Networking

Slides:



Advertisements
Similar presentations
Socket Programming Computer Networks, Spring 2008 Your TAs.
Advertisements

Introduction to Sockets Jan Why do we need sockets? Provides an abstraction for interprocess communication.
Socket Programming. Basics Socket is an interface between application and network – Application creates a socket – Socket type dictates the style of communication.
Sop, Fan Reference: Daniel Spangenberger Computer Networks PPT-4 Socket Programming.
I/O Multiplexing Road Map: 1. Motivation 2. Description of I/O multiplexing 3. Scenarios to use I/O multiplexing 4. I/O Models  Blocking I/O  Non-blocking.
Daemon Processes Long lived utility processes Often started at system boot and ended when system shuts down Run in the background with no controlling terminal.
Network Server Programming Expression Evaluation Tutorial #10 CPSC 261.
Today’s topic Issues about sending structures with TCP. Server design alternatives: concurrent server and multiplexed server. I/O multiplexing.
15-441: Computer Networking Lecture 3: Application Layer and Socket Programming.
Global Employee Location Server Jeff Zhou 3/19/2011 CS4516 HELP Session 1 Modified based on CS4514 B05 slides.
Computer Networks Sockets. Sockets and the OS F An end-point for Internet connection –What the application “plugs into” –OS provides Application Programming.
Advanced Sockets Amit Mondal TA, Intro to Networking Jan 22, 2009 Recital 3 Introduction to Networking Instructor: Prof. Aleksandar Kuzmanovic.
Network Programming UNIX Internet Socket API. Everything in Unix is a File –When Unix programs do any sort of I/O, they do it by reading or writing to.
1 Socket Interfaces Professor Jinhua Guo CIS527 Fall 2003.
Sockets and concurrency Spring 2010, Recitation 3 Your Awesome TAs.
I/O Multiplexing© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer Science.
Programming with Berkeley Sockets Presented by Chris GauthierDickey Written by Daniel Stutzbach (I think!) for CIS 432/532 Useful References: ● man pages.
Event-Driven Programming Vivek Pai Dec 5, GedankenBits  What does a raw bit cost?  IDE  40GB: $100  120GB: $180  32MB USB Pen: $38  FireWire:
1 Data Communications and Networking Socket Programming Part II: Design of Server Software Reference: Internetworking with TCP/IP, Volume III Client-Server.
CS 311 – Lecture 18 Outline IPC via Sockets – Server side socket() bind() accept() listen() – Client side connect() Lecture 181CS Operating Systems.
Introduction to Socket Programming April What is a socket? An interface between application and network –The application creates a socket –The socket.
Winsock programming.  TCP/IP UDP TCP  Winsock #include wsock32.lib.
Introduction to Project 1 Web Client and Server Jan 2006.
Select The select function determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O. int select( int nfds, fd_set*
IP Multiplexing Ying Zhang EECS 489 W07.
Lecture 2 Socket Programming Spring 2004
Sockets and intro to IO multiplexing. Goals We are going to study sockets programming as means to introduce IO multiplexing problem. We will revisit socket.
Networked Applications: Sockets
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Networking Concepts, Socket Programming Spring 2012.
1 Internet Socket programming Behzad Akbari. 2 Sharif University of Technology, Kish Island Campus What is an API? API – stands for Application Programming.
Socket Models Different ways to manage your connections.
Review: How to create a TCP end point? What is the right format for sin_port and sin_addr in the sockaddr_in data structure? How many different ways we.
TELE 402 Lecture 4: I/O multi … 1 Overview Last Lecture –TCP socket and Client-Server example –Source: Chapters 4&5 of Stevens’ book This Lecture –I/O.
Client-Server Applications Approx. text coverage: Chap. 21, Vol III.
1 COMP/ELEC 429/556 Introduction to Computer Networks Creating a Network Application Some slides used with permissions from Edward W. Knightly, T. S. Eugene.
Socket Programming Lec 2 Rishi Kant. Review of Socket programming Decide which type of socket – stream or datagram. Based on type create socket using.
Sockets in C. 2 References Manual Pages %torch man –s 3socket … Socket, bind, listen, etc. %torch man –s 3c select Resources section of website.
1 I/O Multiplexing We often need to be able to monitor multiple descriptors:We often need to be able to monitor multiple descriptors: –a generic TCP client.
CSCE 515: Computer Network Programming Select Wenyuan Xu Department of Computer Science and Engineering.
I/O Multiplexing. TCP Echo Client: I/O operation is sequential !! tcpcliserv/tcpcli01.c: lib/str_cli.c: TCP Client TCP Server stdin stdout fgets fputs.
CE Operating Systems Lecture 13 Linux/Unix interprocess communication.
Project 2: Socket Programming. Overview Sockets Working with sockets Client-Server example Project 1 Hints.
I/O Multiplexing. What is I/O multiplexing? When an application needs to handle multiple I/O descriptors at the same time –E.g. file and socket descriptors,
Practical Sockets and Threads Derek Weitzel. Windows Threads Concurrent processing Concurrent processing Windows Create Thread Windows Create Thread HANDLE.
Single Process, Concurrent, Connection-Oriented Servers (TCP) (Chapter 12)
UNIX Internet Socket API
Threads versus Events CSE451 Andrew Whitaker. This Class Threads vs. events is an ongoing debate  So, neat-and-tidy answers aren’t necessarily available.
2: Application Layer 1 Socket Programming UNIX Network Programming, Socket Programming Tutorial:
回到第一頁 Client/sever model n Client asks (request) – server provides (response) n Typically: single server - multiple clients n The server does not need.
Socket Programming. Computer Science, FSU2 Interprocess Communication Within a single system – Pipes, FIFOs – Message Queues – Semaphores, Shared Memory.
EECS340 Recitation 1: Very helpful to your project Hongyu Gao 1.
@Yuan Xue CS 283Computer Networks Spring 2013 Instructor: Yuan Xue.
Life, Liberty, and the Pursuit of...Sockets! Athula Balachandran IIT-M, GHC 7609 Wolf Richter UVA, GHC 9127.
More Project 1 and HW 1 stuff! Athula Balachandran Wolfgang Richter
I/O Multiplexing.
Socket programming Péter Verhás August 2002
CS 3214 Computer Systems Godmar Back.
Introduction to Networking , Instructor: Prof. Yan Chen
Preemption Set timer interrupts But now, must synchronize Two tools:
Pertemuan 7 I/O Multiplexing
Review: TCP Client-Server Interaction
Imam Ahmad Trinugroho, ST., MMSI
Concurrent Servers Topics Limitations of iterative servers
CISC2200 Threads Spring 2015.
Lecture 4 Socket Programming Issues
Lecture 11 Overview.
TCP Sockets Programming
Socket Programming.
Jan Ecs152b Behrooz Khorashadi
I/O Multiplexing We often need to be able to monitor multiple descriptors: a generic TCP client (like telnet) need to be able to handle unexpected situations,
Presentation transcript:

Advanced Sockets Introduction to Networking Instructor: Prof. Aleksandar Kuzmanovic Advanced Sockets Bin Lin TA , Intro to Networking Jan 19, 2005 Recital 3

Homework grader Geet Duggal, geet@geetduggal.com. Office hours on Tuesdays between 4 and 6

The problem You are a server and you want to listen for incoming connections as well as keep reading from the connections you already have. Blocking "block" is techie jargon for "sleep". Lots of functions block. accept() blocks. All the recv() functions block

The select call Enables you to deal with many clients at the same time HOW ? Monitors several sockets at the same time. tell you which ones are ready for reading, which are ready for writing,

Synopsis of select() #include <sys/time.h> #include <sys/types.h> #include <unistd.h> int select(int numfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); It'll tell you which ones are ready for reading, which are ready for writing, and which sockets have raised exceptions, if you really want to know that.

Manipulate sets Each set is of the type fd_set. The following macros operate on this type: FD_ZERO(fd_set *set) -- clears a file descriptor set FD_SET(int fd, fd_set *set) -- adds fd to the set FD_CLR(int fd, fd_set *set) -- removes fd from the set FD_ISSET(int fd, fd_set *set) -- tests to see if fd is in the set Example - when select() returns, readfds will be modified to reflect which of the file descriptors you selected is ready for reading. Test them with the macro FD_ISSET(),

A multi-person chat server THE CODE A multi-person chat server

A multi-person chat server DEMO A multi-person chat server

Important Points Accepting new connections via select Client closes connection Select returns “socket ready to read” recv() will return 0.