CS 447 Networks and Data Communication Server-Process Organization IP address and SockAddr_In Data Structure Department of Computer Science Southern Illinois.

Slides:



Advertisements
Similar presentations
Network Programming Topics Peeking at Internet traffic Programmer’s view of the Internet (review) Sockets interface Writing clients and servers Understanding.
Advertisements

Chris Riesbeck, Fall 2007 Network Programming Topics –Sockets interface –Writing clients and servers.
Elementary TCP Sockets© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer.
Socket Programming Application Programming Interface.
Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki CS 547/490 Network.
1 Socket Interfaces Professor Jinhua Guo CIS527 Fall 2003.
תקשורת באינטרנט 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.
Network Programming November 19, 2007 Topics Peeking at Internet traffic Programmer’s view of the Internet (review) Sockets interface Writing clients and.
Network Programming Nov 21, 2002 Topics Programmer’s view of the Internet (review) Sockets interface Writing clients and servers class26.ppt “The.
CS 311 – Lecture 18 Outline IPC via Sockets – Server side socket() bind() accept() listen() – Client side connect() Lecture 181CS Operating Systems.
1 Example (UDP Client) // This program sends UDP packets to the given address #include #define SERVER_ADDR " " #define SERVER_PORT 5555 void error(char.
Socket Addresses. Domains Internet domains –familiar with these Unix domains –for processes communicating on the same hosts –not sure of widespread use.
Networking S04, Recitation, Section A
Recitation 12: 11/25/02 Outline Socket Interface –Echo Client/Server Http Protocol Evaluation Annie Luo Office Hours: Thursday.
TCP Socket Programming. r An abstract interface provided to the application programmer  File descriptor, allows apps to read/write to the network r Allows.
CS345 Operating Systems Φροντιστήριο Άσκησης 2. Inter-process communication Exchange data among processes Methods –Signal –Pipe –Sockets.
CS 447 Networks and Data Communication
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.
Department of Computer Science Southern Illinois University Edwardsville Spring, 2008 Dr. Hiroshi Fujinoki FTP Protocol Programming.
Sockets API Overview Sockets with UDP Sockets with TCP Fast Sockets (Fast UDP) IP Multicasting.
CS 447 Networks and Data Communication ARP (Address Resolution Protocol) for the Internet Department of Computer Science Southern Illinois University Edwardsville.
Remote Shell CS230 Project #4 Assigned : Due date :
Technical Details for sockaddr_in Structure Department of Computer Science Southern Illinois University Edwardsville Fall, 2015 Dr. Hiroshi Fujinoki
Lab 5 Sockets. Useful Sockets Links (courtesy of Stanford University) Programming UNIX Sockets in C - Frequently Asked Questions
1 Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Lecture 3: Sockets.
Network programming Nov 16, 2000 Topics Client-server model Sockets interface Echo client and server class24.ppt “The course that gives CMU its.
CSCE 515: Computer Network Programming UDP Socket Wenyuan Xu Department of Computer Science and Engineering.
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.
Distance-Vector Routing Department of Computer Science Southern Illinois University Edwardsville Fall, 2013 Dr. Hiroshi Fujinoki
Sockets Socket = abstraction of the port concept: –Application programs request that the operating system create a socket when one is needed –O.S. returns.
Department of Computer Science Southern Illinois University Edwardsville Spring, 2008 Dr. Hiroshi Fujinoki FTP Protocol Programming.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: HsinYu Ha.
Intro to Socket Programming CS 360. Page 2 CS 360, WSU Vancouver Two views: Server vs. Client Servers LISTEN for a connection and respond when one is.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
2: Application Layer 1 Socket Programming UNIX Network Programming, Socket Programming Tutorial:
1 Spring Semester 2008, Dept. of Computer Science, Technion Internet Networking recitation #7 Socket Programming.
Carnegie Mellon Proxy & Networking : Introduction to Computer Systems – Recitation H April 11, 2011.
1 Networking Programming. 2 Outline Connection & Socket Sockets Interface –Functions –Echo Client and Server Suggested Reading: –11.4.
Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki CS 547/490 Network.
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.
Socket Programming(1/2). Outline  1. Introduction to Network Programming  2. Network Architecture – Client/Server Model  3. TCP Socket Programming.
CLIENT (Browser) socket accept C1 C2 recv C2 recv send C2 send end_thread recv C3 send bind connect Web Server Proxy recv close C3 close C2 end_thread.
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
Jim Fawcett CSE 681 – Software Modeling & Analysis Fall 2002
IE.
Network Programming April 11, 2008
Network Programming with Sockets
Network programming Nov 27, 2001
Transport layer API: Socket Programming
Recitation 11 – 4/29/01 Outline Sockets Interface
Network Programming CSC- 341
TCP Sockets Programming
Networking Programming
Introduction to Berkeley Sockets
Chapter 06. UDP Server/Client.
Jan Ecs152b Behrooz Khorashadi
Chapter 3 Socket API © Bobby Hoggard, Department of Computer Science, East Carolina University These slides may not be used or duplicated without permission.
Network Programming November 3, 2008
Sockets Programming Socket to me!.
Sockets Programming Socket to me!.
Chapter 04. TCP Server/Client.
Socket Programming Neil Tang 09/08/2008
Example (UDP Client) // This program sends UDP packets to the given address #include #include #include #include.
Internet Networking recitation #8
Jim Fawcett CSE 681 – Software Modeling & Analysis Summer 2003
Presentation transcript:

CS 447 Networks and Data Communication Server-Process Organization IP address and SockAddr_In Data Structure Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki Socekt-2/000

Socekt-2/001 Project Phase 1: Suggested server organization CS447 - Computer and Data Communication socket_id = socket ( ……. ): void main (void) { bind (socket_id, ……. ): listen (socket_id, ……. ): duplicated_socket = accept (socket_id, ……. ): recv (duplicated_socket, ……. ): send (duplicated_socket, ……. ): closesocket (duplicated_socket): int socket_id int duplicated_socket while (TRUE) { Not “socket_id” but “duplicated_socket” } Infinite loop

Socekt-2/002 CS447 - Computer and Data Communication socket_id = socket ( ……. ): void main (void) { bind (socket_id, ……. ): listen (socket_id, ……. ): struct sockaddr_in server_addr; /* Server Internet address */ struct sockaddr_in client_addr; /* Client address */ Project Phase 1: Suggested server organization (continued) We are going to create two “sockaddr_in” data structures   duplicated_socket = accept (socket_id, ……. ):   “sockaddr_in” structure  Hold IP address and port

Socekt-2/003 CS447 - Computer and Data Communication socket_id = socket ( ……. ): void main (void) { bind (socket_id, (struct sockaddr *) &server_addr, ….. ): listen (socket_id, ……. ): struct sockaddr_in server_addr; /* Server Internet address */ struct sockaddr_in client_addr; /* Client address */ Project Phase 1: Suggested server organization (continued)   duplicated_socket = accept (socket_id, ……. ):  

CS447 - Computer and Data Communication Server Host Computer Network Interface Card (NIC) Network A Network B NIC IP: IP: server_addr.sin_family = AF_INET; /* Address Family To Be Used */ server_addr.sin_port = htons (1050); /* Port number */ server_addr.sin_addr.s_addr = htonl ( ); /* IP address */ Socekt-2/004 Accept request only from network A

CS447 - Computer and Data Communication Server Host Computer Network Interface Card (NIC) Network A Network B NIC IP: IP: server_addr.sin_family = AF_INET; /* Address Family To Be Used */ server_addr.sin_port = htons (1050); /* Port number */ server_addr.sin_addr.s_addr = htonl ( ); /* IP address */ Socekt-2/005 Accept request only from network B

CS447 - Computer and Data Communication Server Host Computer Network Interface Card (NIC) Network A Network B NIC IP: IP: server_addr.sin_family = AF_INET; /* Address Family To Be Used */ server_addr.sin_port = htons (1050); /* Port number */ server_addr.sin_addr.s_addr = htonl (INADDR_ANY); /* IP address */ Socekt-2/006 Accept requests from both networks

Socekt-2/007 CS447 - Computer and Data Communication socket_id = socket ( ……. ): void main (void) { bind (socket_id, ……. ): listen (socket_id, ……. ): struct sockaddr_in server_addr; /* Server Internet address */ struct sockaddr_in client_addr; /* Client address */ Project Phase 1: Suggested server organization (continued) duplicated_socket = accept (socket_id, (struct sockaddr *) &client_addr, …… ):   IP address of a client Port# of a client

Socekt-2/008 CS447 - Computer and Data Communication socket_id = socket ( ……. ): void main (void) { bind (socket_id, server_addr, ….. ): listen (socket_id, ……. ): struct sockaddr_in server_addr; /* Server Internet address */ struct sockaddr_in client_addr; /* Client address */ Project Phase 1: Suggested server organization (continued) duplicated_socket = accept (socket_id, client_addr, p_client_add_size); int client_add_size = sizeof(client_addr); int * p_client_add_size = &client_add_size;