WinSock. What Is Sockets What Is Windows Sockets What Are Its Benefits Architecture of Windows Sockets Network Application Mechanics
|
|
- Toby Reynolds
- 5 years ago
- Views:
Transcription
1 WinSock What Is Sockets What Is Windows Sockets What Are Its Benefits Architecture of Windows Sockets Network Application Mechanics
2 What Is Sockets Standard API (Application Programming Interface) for Network Programming OS: UNIX Language: C Standards: Berkeley Sockets System V Transport Layer Interface (TLI)
3 What Is Standard
4 What Is Windows Sockets WinSock Standard Windows Sockets API (WSA) for Windows Network Programming OS: Microsoft Windows/NT Language: C Variants: Java, BCB, VB,...
5 What Are Its Benefits Open Standard Binary Compatibility Source Code Portability Dynamic Linking
6 DLL (Dynamic Link Library) call draw(...) int draw(...) Program A main memory Program A call draw(...) call draw(...) duplicated Program B call draw(...) int draw(...) Program B DLL int draw(...)
7 DLL Code sharing (Memory saving) only one copy of the DLL code in memory Modularization to change the DLL without changing the application, or vice versa Compatible application binary interface (ABI) to allow portability of executables, not just source code
8 Architecture of Windows Sockets telnet ftp browser other applications Windows Sockets API Windows Sockets Dynamic Link Library (WINSOCK.DLL/WSOCK32.DLL/WS2-32.DLL) TCP/IP DECNet Appletalk SPX/IPX Multiple Protocol Stack Driver (ODI, Packer Driver, NDIS) Network Interface (Ethernet, Token Ring, Serial, etc.) Transmission Media
9 Network Application Mechanics Client-Server Model Association Network Program Sketch
10 Client-Server Mode (file server) (printer server) (client)
11 Association current CLIENT to know each other SERVER data
12 Association with Multiple Outlets CLIENT CLIENT SERVER CLIENT CLIENT
13 Elements of Association Protocol Client IP Address Client Port Number Server IP Address Server Port Number
14 Client-Server Association Client Port Number Server Port Number CLIENT Client IP Address Protocol Server IP Address SERVER
15 Network Program Sketch Open a socket Name the socket Associate with another socket Send and receive between sockets Close the socket
16 Step1: Open A Socket WinSock #include <winsock.h> SOCKET PASCAL FAR socket (int family, int type, int protocol); Berkeley Socket #include <sys/types.h> #include <sys/socket.h> int socket (int family, int type, int protocol);
17 Return Value WinSock success: a value called a socket descriptor failure: INVALID_SOCKET Berkeley Socket success: a socket descriptor failure: < 0
18 Address Family AF_INET PF_INET Internet protocols AF_UNIX PF_UNIX UNIX internal protocols AF_NS PF_NS Xerox NS protocols AF_IMPLINK PF_IMPLINK IMP link layer AF_IPX PF_IPX IPX/SPX AF_APPLETALK PF_APPLETALK Appletalk
19 Type SOCK_STREAM SOCK_DGRAM SOCK_RAW SOCK_SEQPACKET SOCK_RDM stream socket datagram socket raw socket sequenced packet socket reliably delivered message socket
20 Family And Type AF_UNIX AF_INET AF_NS SOCK_STREAM Yes TCP SPP SOCK_DGRAM Yes UDP IDP SOCK_RAW IP Yes SOCK_SEQPACKET SPP
21 #include <netinet/in.h> /* for IPPROTO_xxx */ #include <netns/ns.h> /* for NSPROTO_xxx */ Protocol family type protocol comment AF_INET SOCK_DGRAM IPPROTO_UDP UDP AF_INET SOCK_STREAM IPPROTO_TCP TCP AF_INET SOCK_RAW IPPROTO_ICMP ICMP AF_INET SOCK_RAW IPPROTO_RAW (raw) AF_NS SOCK_STREAM NSPROTO_SPP SPP AF_NS SOCK_SEQPACKET NSPROTO_SPP SPP AF_NS SOCK_RAW NSPROTO_ERROR error protocol AF_NS SOCK_RAW NSPROTO_RAW (raw)
22 Association After socket() Elements Client Server Protocol set set Client IP Address not yet not yet Client Port Number not yet not yet Server IP Address not yet not yet Server Port Number not yet not yet
23 Step2: Name The Socket WinSock #include <winsock.h> int PASCAL FAR bind (SOCKET sockfd, struct sockaddr FAR *addr, int addrlen); Berkeley Socket #include <sys/types.h> #include <sys/socket.h> int bind (int sockfd, struct sockaddr *addr, int addrlen); addrlen: sizeof(struct sockaddr)
24 Return Value WinSock success: 0 failure: SOCKET_ERROR Berkeley Socket success: 0 failure: < 0
25 Client Socket Name Is Optional A server must name its socket to allow the client to find it on the network. A client is not required to name its socket, but neither is it restricted from naming it. On a TCP socket, the protocol stack implicitly names the socket when connect() is called. On a UDP socket, the protocol stack implicitly names the socket when connect() or sendto() is called.
26 sockaddr Structure #include <sys/socket.h> struct sockaddr { u_short sa_family; /* address family: AF_xxx */ char sa_data[14]; /* host address for general purpose */ };
27 #include <netinet/in.h> struct in_addr { }; sockaddr_in Structure u_long s_addr; /* 32-bit IP address in network order */ struct { }; sockaddr_in short sin_family; /* address family: PF_INET */ u_short sin_port; /* 16-bit port number in network order */ struct in_addr sin_addr; /* 32-bit IP address in network order */ char sin_zero[8]; /* not used */
28 Port Numbers Reserved for well-known services (e.g., FTP) 1024 Reserved for IANA (Internet Assigned Numbers Authority) Typical range for user-defined services System dependent (new services or system services)
29 Get Legal Port Number Motivation Without knowing which port is available Porting in different system How? Set port number 0 and then call bind() to get an available port number
30 Set Local IP Address Motivation Without knowing what IP address the host has Porting in different system How? Set IP address INADDR_ANY and call bind() to assign the local IP address automatically
31 Network Byte Ordering vs. Host Byte Ordering 0x7531 big endian network byte order little endian host byte order on Intel processors byte nibble in the memory
32 Problem With Byte Ordering PortNumber = 0x7531; interpret in network byte order unknown port number 0x host byte order in the memory send
33 Byte Ordering Functions u_short PASCAL FAR htons (u_short hostshort); u_short PASCAL FAR ntohs (u_short netshort); u_long PASCAL FAR ntohl (u_long netlong); u_long PASCAL FAR htonl (u_long hostlong);
34 Example struct sockaddr_in serveraddr; serveraddr.sin_family=af_inet; serveraddr.sin_addr.s_addr=htonl(inaddr_any); serveraddr.sin_port=0; if(bind(serversock, (struct sockaddr *)&serveraddr, sizeof(serveraddr))) { puts("server: bind() error."); close(serversock); exit(1); }
35 Example (continued) int serverlen; serverlen=sizeof(serveraddr); if(getsockname(serversock, (struct sockaddr *)&serveraddr, &serverlen)) { puts("server: getsockname() error."); close(serversock); exit(1); } printf("server: Port Number is %d\n", ntohs(serveraddr.sin_port));
36 Association After bind() Elements Client Server Protocol set set Client IP Address set not yet Client Port Number set not yet Server IP Address not yet set Server Port Number not yet set
37 Step 3: Associate With Another Socket Server prepares for an association A datagram (UDP) server does not do anything to prepare to associate with a client, since it creates an association when it receives data. Client initiates the association Server completes the association
38 Step 3.1: TCP Server Prepares WinSock For An Association int PASCAL FAR listen (SOCKET sockfd, int backlog); Berkeley Socket int listen (int sockfd, int backlog); backlog: the number of incoming connection requests you want the stack to queue
39 Return Value WinSock success: 0 failure: SOCKET_ERROR Berkeley Socket success: 0 failure: < 0
40 Step 3.2: Client Initiates The WinSock Association #include <winsock.h> int PASCAL FAR connect (SOCKET sockfd, struct sockaddr FAR *serveraddr, int addrlen); Berkeley Socket #include <sys/types.h> #include <sys/socket.h> int connect (int sockfd, struct sockaddr *serveraddr, int addrlen);
41 Return Value WinSock success: 0 failure: SOCKET_ERROR Berkeley Socket success: 0 failure: < 0
42 Association Initialization By UDP Clients Is Optional The advantage to using sendto() is that the target of each datagram can be changed. Function connect() can be called to establish the remote target when the UDP socket will send to the same remote address for the life of the socket, and/or a filter is needed to be set on that socket for receiving only datagrams from the named destination address
43 Step 3.3: TCP Server Completes The Association WinSock #include <winsock.h> SOCKET PASCAL FAR accept (SOCKET sockfd, struct sockaddr FAR *clientaddr, int FAR *addrlen); Berkeley Socket #include <sys/types.h> #include <sys/socket.h> int accept (int sockfd, struct sockaddr *clientaddr, int *addrlen);
44 Return Value WinSock success: a socket descriptor failure: INVALID_SOCKET (not SOCKET_ERROR) Berkeley Socket success: a socket descriptor failure: < 0
45 Client Socket vs. Server Socket Client 1 cs=socket() Client 2 cs=socket() Server ss=socket() connect(cs,...) connect(cs,...) cs1=accept(ss,...) cs2=accept(ss,...) send(cs,...) recv(cs,...) send(cs,...) recv(cs,...) send(cs1,...) recv(cs1,...) send(cs2,...) recv(cs2,...)
46 Step 4: Send And Receive With WinSock int PASCAL FAR send (SOCKET sockfd, const char FAR *buf, int len, int flags); int PASCAL FAR sendto (SOCKET sockfd, const char FAR *buf, int len, int flags, struct sockaddr FAR *to, int addrlen); int PASCAL FAR recv (SOCKET sockfd, char FAR *buf, int len, int flags); int PASCAL FAR recvfrom (SOCKET sockfd, char FAR *buf, int len, int flags, struct sockaddr FAR *from, int *addrlen);
47 Step 4: Send And Receive With Berkeley Socket int send (int sockfd, char *buf, int len, int flags); int sendto (int sockfd, char *buf, int len, int flags, struct sockaddr *to, int addrlen); int recv (int sockfd, char *buf, int len, int flags); int recvfrom (int sockfd, char *buf, int len, int flags, struct sockaddr *from, int *addrlen);
48 Return Value For send() / sendto() WinSock success: the number of bytes sent on success failure: SOCKET_ERROR Berkeley Socket success: the number of bytes sent on success failure: < 0
49 WinSock Return Value For recv() / recvfrom() success: the number of bytes received failure: SOCKET_ERROR Berkeley Socket success: the number of bytes received failure: < 0 A return value with 0 indicates the other side has finished data transmission.
50 Socket s Read / Write Client 1 cs=socket() Client 2 cs=socket() Server ss=socket() connect(cs,...) connect(cs,...) cs1=accept(ss,...) cs2=accept(ss,...) send(cs,...) recv(cs,...) send(cs,...) recv(cs,...) send(cs1,...) recv(cs1,...) send(cs2,...) recv(cs2,...)
51 Flags Flags for send() / sendto() MSG_OOB MSG_DONTROUTE Flags for recv() / recvfrom() MSG_OOB MSG_PEEK to find out how much data is available for reading without removing received data from the protocol stack s buffers
52 Step 5: Close The Socket WinSock int PASCAL FAR closesocket (SOCKET sockfd); Berkeley Socket int close (int sockfd);
53 Return Value WinSock success: 0 failure: SOCKET_ERROR Berkeley Socket success: 0 failure: < 0
54 Client 1 Close Sockets Client 2 Server cs=socket() cs=socket() ss=socket() connect(cs,...) connect(cs,...) cs1=accept(ss,...) cs2=accept(ss,...) send(cs,...) recv(cs,...) send(cs,...) recv(cs,...) send(cs1,...) recv(cs1,...) send(cs2,...) recv(cs2,...)
55 Partial Close WinSock int PASCAL FAR shutdown (SOCKET sockfd, int howto); Berkeley Socket int shutdown (int sockfd, int howto); howto: flag that indicates the behavior
56 Return Value WinSock success: 0 failure: SOCKET_ERROR Berkeley Socket success: 0 failure: < 0
57 howto 0 (not recommended due to many problems) receives are disallowed (lower layer protocols are not affected) 1 (graceful close) sends are disallowed (a TCP FIN is sent to remote socket) 2 both sends and receives are disallowed (a TCP FIN is sent to remote socket)
58 TCP Network Applications client socket() initialize sockaddr_in structure connect() send() / recv() server socket() initialize sockaddr_in structure bind() listen() accept() recv() / send() closesocket() closesocket() closesocket()
59 UDP Network Applications 1 client socket() initialize sockaddr_in structure connect() send() / sendto() recv() / recvfrom() closesocket() server socket() initialize sockaddr_in structure bind() recvfrom() sendto() closesocket()
60 UDP Network Applications 2 client socket() initialize sockaddr_in structure server socket() initialize sockaddr_in structure bind() sendto() recvfrom() closesocket() recvfrom() sendto() closesocket()
61 Startup And Cleanup In WinSock Every WinSock application must initialize the WinSock DLL before it begins operation and notify the DLL to cleanup when it has done. A WinSock DLL needs to know when every process comes and goes so it can allocate and deallocate process-specific resources.
62 WSAStartup() int PASCAL FAR WSAStartup (WORD wversionrequired, LPWSADATA lpwsadata); Return Value success: 0 failure: an error value (not SOCKET_ERROR)
63 WinSock Version wversionrequired: the major.minor version number The LSB is the major version, and the MSB is the minor version (revision number). version 1.1: 0x0101 version 2.0: 0x0002
64 WSAData typedef struct WSAData { WORD wversion; WORD whighversion; char szdescription[wsadescription_len+1]; char szsystemstatus[wsasys_status_len+1]; long imaxsockets; long imaxudpdg; char FAR *lpvendorinfo; } WSADATA;
65 Members In WSADATA wversion the version of the Windows Sockets specification that the Windows Sockets DLL expects the caller to use whighversion the highest version of the Windows Sockets specification that this DLL can support szdescription a null-terminated string into which a WinSock vendor can put any description
66 Members In WSADATA szsystemstatus a null-terminated string into which the WinSock DLL copies relevant status or configuration information imaxsockets the maximum number of sockets a single process can potentially open imaxudpdg the size in bytes of the largest UDP datagram that can be sent or received by the WinSock implementation
67 Members In WSADATA lpvendorinfo a far pointer to vendor-specific data structure
68 WSACleanup() int PASCAL FAR WSACleanup (void); Return Value success: 0 failure: SOCKET_ERROR
69 Error Reporting int PASCAL FAR WSAGetLastError (void); to return the error value which is reset only when the next WinSock function fails
70 Some Error Values bind() WSAEADDRINUSE(10048) listen() WSAEMFILE(10024) connect() WSAECONNREFUSED(10061) WSAEADDRINUSE(10048) send() WSAENOTCONN(10057) WSAEMSGSIZE(10040) closesocket() WSAENOTSOCK(10038)
Socket Programming. CSIS0234A Computer and Communication Networks. Socket Programming in C
1 CSIS0234A Computer and Communication Networks Socket Programming in C References Beej's Guide to Network Programming Official homepage: http://beej.us/guide/bgnet/ Local mirror http://www.cs.hku.hk/~c0234a/bgnet/
More informationOral. Total. Dated Sign (2) (5) (3) (2)
R N Oral Total Dated Sign (2) (5) (3) (2) Assignment Group- A_07 Problem Definition Write a program using TCP socket for wired network for following Say Hello to Each other ( For all students) File transfer
More informationTutorial on Socket Programming
Tutorial on Socket Programming Computer Networks - CSC 458 Department of Computer Science Hao Wang (Slides are mainly from Seyed Hossein Mortazavi, Monia Ghobadi, and Amin Tootoonchian, ) 1 Outline Client-server
More informationHybrid of client-server and P2P. Pure P2P Architecture. App-layer Protocols. Communicating Processes. Transport Service Requirements
Announcements CS 5565 Network Architecture and Protocols Lecture 5 Godmar Back Problem Set 1 due Feb 17 Project 1 handed out shortly 2 Layer The Layer Let s look at some s (in keeping with top-down) architectures:
More informationUnix Network Programming
Introduction to Computer Networks Polly Huang EE NTU Unix Network Programming The socket struct and data handling System calls Based on Beej's Guide to Network Programming 1 The Unix Socket A file descriptor
More informationSession NM056. Programming TCP/IP with Sockets. Geoff Bryant Process software
Session NM056 Programming TCP/IP with Sockets Geoff Bryant Process software Course Roadmap Slide 57 NM055 (11:00-12:00) Important Terms and Concepts TCP/IP and Client/Server Model Sockets and TLI Client/Server
More informationCLIENT-SIDE PROGRAMMING
CLIENT-SIDE PROGRAMMING George Porter Apr 11, 2018 ATTRIBUTION These slides are released under an Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Creative Commons license These slides
More informationPorts under 1024 are often considered special, and usually require special OS privileges to use.
1 2 Turns out that besides an IP address (used by the IP layer), there is another address that is used by TCP (stream sockets) and, coincidentally, by UDP (datagram sockets). It is the port number. It's
More informationContext. Distributed Systems: Sockets Programming. Alberto Bosio, Associate Professor UM Microelectronic Departement
Distributed Systems: Sockets Programming Alberto Bosio, Associate Professor UM Microelectronic Departement bosio@lirmm.fr Context Computer Network hosts, routers, communication channels Hosts run applications
More informationTCP: Three-way handshake
Sockets in C 1 Sockets in C The slides by themselves will not be sufficient to learn how to write socket code. If you did not attend class, then you will want to review the relevant chapters in Kerrisk
More informationCS321: Computer Networks Introduction to Application Layer
CS321: Computer Networks Introduction to Application Layer Dr. Manas Khatua Assistant Professor Dept. of CSE IIT Jodhpur E-mail: manaskhatua@iitj.ac.in Basic Application layer provides services to the
More informationSOCKETS. COMP750 Distributed Systems
SOCKETS COMP750 Distributed Systems Sockets The Socket library is a traditional Application Program Interface (API) to the transport layer. Sockets were originally implemented in Unix systems and have
More informationSocket Programming. Dr. -Ing. Abdalkarim Awad. Informatik 7 Rechnernetze und Kommunikationssysteme
Socket Programming Dr. -Ing. Abdalkarim Awad Informatik 7 Rechnernetze und Kommunikationssysteme Before we start Can you find the ip address of an interface? Can you find the mac address of an interface?
More informationSocket Programming. Sungkyunkwan University. Hyunseung Choo Copyright Networking Laboratory
Socket Programming Sungkyunkwan University Hyunseung Choo choo@skku.edu Copyright 2000-2019 Networking Laboratory Contents Goals Client-Server mechanism Introduction to socket Programming with socket on
More informationTypes (Protocols) Associated functions Styles We will look at using sockets in C Java sockets are conceptually quite similar
Socket Programming What is a socket? Using sockets Types (Protocols) Associated functions Styles We will look at using sockets in C Java sockets are conceptually quite similar - Advanced Data Communications:
More informationHyo-bong Son Computer Systems Laboratory Sungkyunkwan University
Sockets Hyo-bong Son (proshb@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Client-Server Model Most network application is based on the client-server model: A server
More informationA Client-Server Exchange
Socket programming A Client-Server Exchange A server process and one or more client processes Server manages some resource. Server provides service by manipulating resource for clients. 1. Client sends
More informationSockets. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University Embedded Software Lab.
1 Sockets Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University http://nyx.skku.ac.kr Internet Connections (1) 2 Connection Clients and servers communicate by sending streams of bytes over
More informationCS321: Computer Networks Socket Programming
CS321: Computer Networks Socket Programming Dr. Manas Khatua Assistant Professor Dept. of CSE IIT Jodhpur E-mail: manaskhatua@iitj.ac.in Socket Programming It shows how the network application programs
More informationMSc Integrated Electronics Networks Assignment. Investigation of TCP/IP Sockets and Ports. Gavin Cameron
MSc Integrated Electronics Networks Assignment Investigation of TCP/IP Sockets and Ports Gavin Cameron Introduction TCP and IP (Transmission Control Protocol / Internet Protocol) are two protocols from
More informationAnnouncements. CS 5565 Network Architecture and Protocols. Queuing. Demultiplexing. Demultiplexing Issues (1) Demultiplexing Issues (2)
Announcements CS 5565 Network Architecture and Protocols Problem Set 1 due Feb 18 Project 1A due Feb 19 Lecture 5 Godmar Back 2 Queuing Demultiplexing send queues Layer k+1 Layer k recv queues End systems
More informationNETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science
NETWORK PROGRAMMING CSC- 341 25 Instructor: Junaid Tariq, Lecturer, Department of Computer Science 26 9 Lecture Sockets as means for inter-process communication (IPC) application layer Client Process Socket
More informationEECS 123: Introduction to Real-Time Distributed Programming
EECS 123: Introduction to Real-Time Distributed Programming Lecture : IP, UDP, TCP, RPC, and Time Measurement This slide-set was prepared by the Teaching Assistant, P. Athreya. * Most of the slides in
More informationSocket Programming TCP UDP
Socket Programming TCP UDP Introduction Computer Network hosts, routers, communication channels Hosts run applications Routers forward information Packets: sequence of bytes contain control information
More informationsottotitolo Socket Programming Milano, XX mese 20XX A.A. 2016/17 Federico Reghenzani
Titolo presentazione Piattaforme Software per la Rete sottotitolo Socket Programming Milano, XX mese 20XX A.A. 2016/17 Outline 1) Introduction to Sockets 2) UDP communication 3) TCP communication 4) RAW
More informationProgramming with TCP/IP. Ram Dantu
1 Programming with TCP/IP Ram Dantu 2 Client Server Computing Although the Internet provides a basic communication service, the protocol software cannot initiate contact with, or accept contact from, a
More informationSockets. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Sockets Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Internet Connections (1) Connection Clients and servers communicate by sending streams of
More informationNetwork programming(i) Lenuta Alboaie
Network programming(i) Lenuta Alboaie adria@info.uaic.ro 2017 2018 Computer Network http://www.info.uaic.ro/~computernetworks 1 Content Client/server paradigm API for network programming BSD Socket Characteristics
More informationClient Server Computing
Client Server Computing Although the Internet provides a basic communication service, the protocol software cannot initiate contact with, or accept contact from, a remote computer. Instead, two application
More informationLecture 7. Followup. Review. Communication Interface. Socket Communication. Client-Server Model. Socket Programming January 28, 2005
Followup symbolic link (soft link): pathname, can be across file systems, replacement of file will be active on all symbolic links, consumes at least an inode. hard link: pointers to an inode, only in
More informationSocket Programming for TCP and UDP
CSCI4430 Data Communication and Computer Networks Socket Programming for TCP and UDP ZHANG, Mi Jan. 19, 2017 Outline Socket Programming for TCP Introduction What is TCP What is socket TCP socket programming
More informationPA #2 Reviews. set_name, get_name, del_name. Questions? Will be modified after PA #4 ~
Sockets Prof. Jin-Soo Kim( jinsookim@skku.edu) TA Dong-Yun Lee(dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu PA #2 Reviews set_name, get_name, del_name Will
More informationProcesses communicating. Network Communication. Sockets. Addressing processes 4/15/2013
Processes communicating Network Communication Process: program running within a host. within same host, two processes communicate using inter-process communication (defined by OS). processes in different
More informationUNIX Sockets. Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E.
UNIX Sockets Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E. Socket and Process Communication application layer User Process Socket transport layer (TCP/UDP) network layer (IP)
More informationCS118 Discussion 1B, Week 1. Taqi Raza BUNCHE 1209B, Fridays 12:00pm to 1:50pm
CS118 Discussion 1B, Week 1 Taqi Raza BUNCHE 1209B, Fridays 12:00pm to 1:50pm 1 TA Taqi, PhD student in Computer Networking Discussion (1B): Bunche 1209, Fri 12:00 1:50 p.m. Office hours: Boelter Hall
More informationSockets 15H2. Inshik Song
Sockets 15H2 Inshik Song Internet CAU www server (www.cau.ac.kr) Your web browser (Internet Explorer/Safari) Sockets 2 How do we find the server? Every computer on the Internet has an Internet address.
More informationCS 640: Computer Networking
CS 640: Computer Networking Yu-Chi Lai Lecture 3 Network Programming Topics Client-server model Sockets interface Socket primitives Example code for echoclient and echoserver Debugging With GDB Programming
More informationElementary TCP Sockets
Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens Distributed Computer Systems 1 socket interface Application 1 Application 2 socket interface user kernel user kernel
More informationChristian Tschudin (basierend auf einem Foliensatz von C. Jelger und T. Meyer) Departement Mathematik und Informatik, Universität Basel
Internettechnologien (CS262) Socket Programming in C 4. März 2015 Christian Tschudin (basierend auf einem Foliensatz von C. Jelger und T. Meyer) Departement Mathematik und Informatik, Universität Basel
More informationSimple network applications using sockets (BSD and WinSock) Revision 1 Copyright Clifford Slocombe
Simple network applications using sockets (BSD and WinSock) Revision 1 Copyright 2002 - Clifford Slocombe sockets@slocombe.clara.net COPYRIGHT 2002 - CLIFFORD SLOCOMBE PAGE 1 OF 8 Table of Contents Introduction...3
More informationThe BSD UNIX Socket Interface (CS 640 Lecture) Assignment 1. Interprocess Communication (IPC) Work Individually (no groups)
The BSD UNIX Socket Interface (CS 640 Lecture) Assignment 1 Work Individually (no groups) Due Date: in class, Monday, September 19 Robert T Olsen olsen@cswiscedu 7390CS Office Hours: 3-5T, 11-12F - exception
More informationPart II: The Winsock API
Part II: The Winsock API Part II of this book is dedicated to Winsock programming on Win32 platforms. Winsock is the preferred interface for accessing a variety of underlying network protocols and is available
More informationChapter 6. The Transport Layer. Transport Layer 3-1
Chapter 6 The Transport Layer Transport Layer 3-1 Transport services and protocols provide logical communication between app processes running on different hosts transport protocols run in end systems
More informationSOCKET PROGRAMMING. What is a socket? Using sockets Types (Protocols) Associated functions Styles
LABORATORY SOCKET PROGRAMMING What is a socket? Using sockets Types (Protocols) Associated functions Styles 2 WHAT IS A SOCKET? An interface between application and network The application creates a socket
More informationReview. Preview. Closing a TCP Connection. Closing a TCP Connection. Port Numbers 11/27/2017. Packet Exchange for TCP Connection
Review Preview Algorithms and Issues in Client Software Design Client Architecture Identifying the Location of a Parsing an Address Argument Looking Up a Domain Name Looking Up a Well-Known Port by Name
More informationA. Basic Function Calls for Network Communications
IV. Network Programming A. Basic Function Calls for Network Communications 1 B. Settings for Windows Platform (1) Visual C++ 2008 Express Edition (free version) 2 (2) Winsock Header and Libraries Include
More informationThe Berkeley Sockets API. Networked Systems Architecture 3 Lecture 4
The Berkeley Sockets API Networked Systems Architecture 3 Lecture 4 The Berkeley Sockets API Widely used low-level C networking API First introduced in 4.3BSD Unix Now available on most platforms: Linux,
More informationNetwork Socket Programming - 2 BUPT/QMUL
Network Socket Programming - 2 BUPT/QMUL 2017-3-20 Review Basic Concepts in NP Introduction to Network Programming Importance Classes Environments in this course Program Developing Phases Skills Useful
More informationNetwork Programming in C: The Berkeley Sockets API. Networked Systems 3 Laboratory Sessions
Network Programming in C: The Berkeley Sockets API Networked Systems 3 Laboratory Sessions The Berkeley Sockets API Widely used low-level C networking API First introduced in 4.3BSD Unix Now available
More informationOutline. Distributed Computer Systems. Socket Basics An end-point for a IP network connection. Ports. Sockets and the OS. Transport Layer.
Outline Distributed Computer Systems Socket basics Socket details (TCP and UDP) Socket options Final notes Sockets Socket Basics An end-point for a IP network connection what the application layer plugs
More informationGroup-A Assignment No. 6
Group-A Assignment No. 6 R N Oral Total Dated Sign (2) (5) (3) (10) Title : File Transfer using TCP Socket Problem Definition: Use Python for Socket Programming to connect two or more PCs to share a text
More informationIntroduction to Computer Networks
Introduction to Computer Networks Tian Song ( 嵩天 ), Ph.D., Assoc. Prof. songtian@bit.edu.cn Introduction to Computer Networks Socket and Network Programming Tian Song ( 嵩天 ), Ph.D., Assoc. Prof. songtian@bit.edu.cn
More informationNetwork Programming in C. Networked Systems 3 Laboratory Sessions and Problem Sets
Network Programming in C Networked Systems 3 Laboratory Sessions and Problem Sets Lab Timetable, Aims, and Objectives Teaching Week Activity 14 Introduction 15 Warm-up exercise 16 17 Web client 18 19 20
More informationECE 435 Network Engineering Lecture 2
ECE 435 Network Engineering Lecture 2 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 6 September 2018 Announcements Homework 1 will be posted. Will be on website, will announce
More informationOutline. Distributed Computing Systems. Socket Basics (1 of 2) Socket Basics (2 of 2) 3/28/2014
Outline Distributed Computing Systems Sockets Socket basics Socket details (TCP and UDP) Socket options Final notes Socket Basics (1 of 2) An end-point for an Internet network connection what application
More informationCSE 124 Discussion Section Sockets Programming 10/10/17
CSE 124 Discussion Section Sockets Programming 10/10/17 Topics What s a socket? Creating a socket Connecting a socket Sending data Receiving data Resolving URLs to IPs Advanced socket options Live code
More informationNetwork Software Implementations
Network Software Implementations Number of computers on the Internet doubling yearly since 1981, nearing 200 million Estimated that more than 600 million people use the Internet Number of bits transmitted
More informationNetwork Socket Programming - 3 BUPT/QMUL
Network Socket Programming - 3 BUPT/QMUL 2018-04-02 Agenda Basic concepts in NP Introduction to IP & TCP/UDP Introduction to Sockets 2 Introduction to Sockets Reviews of some helpful points Sockets interface
More informationOutline. Operating Systems. Socket Basics An end-point for a IP network connection. Ports. Network Communication. Sockets and the OS
Outline Operating Systems Socket basics Socket details Socket options Final notes Project 3 Sockets Socket Basics An end-point for a IP network connection what the application layer plugs into programmer
More informationDepartment of Computer Science
Department of Computer Science Notes on Interprocess Communication in Unix Jean Dollimore,Oct.1990, last revised Feb. 1996 These notes explain how you can write "distributed programs" in C or C++ running
More informationSystem Programming. Sockets
Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Introducing 2 3 Internet
More informationNetwork Socket Programming - 3 BUPT/QMUL
Network Socket Programming - 3 BUPT/QMUL 2017-3-27 Agenda Basic concepts in NP Introduction to IP & TCP/UDP Introduction to Sockets 2 Introduction to Sockets Reviews of some helpful points Sockets interface
More informationUNIX Network Programming. Overview of Socket API Network Programming Basics
UNIX Network Programming Overview of Socket API Network Programming Basics 1 Client-Server Model Client Machine A Network Server Machine B Web browser and server FTP client and server Telnet client and
More informationUNIX Sockets. COS 461 Precept 1
UNIX Sockets COS 461 Precept 1 Socket and Process Communica;on application layer User Process Socket transport layer (TCP/UDP) OS network stack network layer (IP) link layer (e.g. ethernet) Internet Internet
More informationCommunication. Sockets (Haviland Ch. 10)
Communication Sockets (Haviland Ch. 10) 1 Simple Web Request 5LFKDUG V+RPH3DJH &RXUVHV 5HVHDUFK 2 How do we find the server? Every computer on the Internet has an Internet address. Called an IP address
More informationCS 3516: Computer Networks
Welcome to CS 3516: Prof. Yanhua Li Time: 9:00am 9:50am M, T, R, and F Location: AK219 Fall 2018 A-term 1 Some slides are originally from the course materials of the textbook Computer Networking: A Top
More informationNetwork Communication
Network Communication Processes communicating Process: program running within a host. q within same host, two processes communicate using inter- process communica6on (defined by OS). q processes in different
More informationLab 0. Yvan Petillot. Networks - Lab 0 1
Lab 0 Yvan Petillot Networks - Lab 0 1 What You Will Do In This Lab. The purpose of this lab is to help you become familiar with the UNIX/LINUX on the lab network. This means being able to do editing,
More informationCSCE 463/612 Networks and Distributed Processing Spring 2017
CSCE 463/612 Networks and Distributed Processing Spring 2017 Preliminaries II Dmitri Loguinov Texas A&M University January 19, 2017 1 Agenda HTTP basics Windows sockets Clients 2 HTTP Basics General URL
More informationNetworked Applications: Sockets. End System: Computer on the Net
Networked Applications: Sockets Topics Programmer s view of the Internet Sockets interface End System: Computer on the Net Internet Also known as a host 2 Page 1 Clients and Servers Client program Running
More informationApplication Architecture
CS 4/55231 Internet Engineering Kent State University Dept. of Science LECT-2 Application Architecture 1 2 Class Mechanics Topics to Cover Send email and get listed in class email list. Use "IN2004S" in
More informationA Socket Example. Haris Andrianakis & Angelos Stavrou George Mason University
A Socket Example & George Mason University Everything is a file descriptor Most socket system calls operate on file descriptors Server - Quick view socket() bind() listen() accept() send(), recv() close()
More informationSocket Programming. #In the name of Allah. Computer Engineering Department Sharif University of Technology CE443- Computer Networks
#In the name of Allah Computer Engineering Department Sharif University of Technology CE443- Computer Networks Socket Programming Acknowledgments: Lecture slides are from Computer networks course thought
More informationWriting Network Applications using the TCP/IP Protocol Stack: Socket Programming
Writing Network Applications using the TCP/IP Protocol Stack: Socket Programming 1 Web Browser Network - Applications Paradigm Communicating TCP UDP IP LL PL Real Player Typical network app has two pieces:
More informationECE 435 Network Engineering Lecture 2
ECE 435 Network Engineering Lecture 2 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 31 August 2017 Announcements Homework 1 will be posted. Will be on website, will announce
More informationLecture 2. Outline. Layering and Protocols. Network Architecture. Layering and Protocols. Layering and Protocols. Chapter 1 - Foundation
Lecture 2 Outline Wireshark Project 1 posted, due in a week Lab from a different textbook Work through the lab and answer questions at the end Chapter 1 - Foundation 1.1 Applications 1.2 Requirements 1.3
More informationUNIT 1 TCP/IP PROGRAMMING CONCEPTS
UNIT 1 TCP/IP PROGRAMMING CONCEPTS TCP/IP Programming Concepts Structure Page Nos. 1.0 Introduction 5 1.1 Objectives 5 1.2 Client Server Communication 6 1.2.1 Designing Client/Server Programs 7 1.2.2 Socket
More informationNetworks. Practical Investigation of TCP/IP Ports and Sockets. Gavin Cameron
Networks Practical Investigation of TCP/IP Ports and Sockets Gavin Cameron MSc/PGD Networks and Data Communication May 9, 1999 TABLE OF CONTENTS TABLE OF CONTENTS.........................................................
More informationLecture 24. Thursday, November 19 CS 375 UNIX System Programming - Lecture 24 1
Lecture 24 Log into Linux. Copy directory /home/hwang/cs375/lecture24 Final project posted. Due during finals week. Reminder: No class next Tuesday (11/24) Questions? Thursday, November 19 CS 375 UNIX
More informationNetwork Programming November 3, 2008
15-213 Network Programming November 3, 2008 Topics Programmer s view of the Internet (review) Sockets interface Writing clients and servers class20.ppt A Client-Server Transaction Most network applications
More informationTopics for this Week
Topics for this Week Layered Network Architecture ISO/OSI Reference Model Internet Protocol Suite Overview Application Programming Interface BSD Socket API Readings Sections 1.1-1.5, 6.1.3 (socket programming),
More informationHow do we Communicate? Introduction to Unix Network Programming. What does Alice do? What does Bob do? Two simplest networking programs
Introduction to Unix Network Programming Reference: Stevens Unix Network Programming How do we Communicate? Send a mail from Alice to Bob Bob Alice in Champaign, Bob in Hollywood Example: US Postal Service
More informationWhat s an API? Do we need standardization?
Network Interface z The network protocol stack is a part of the OS z Need an API to interface applications to the protocol stack. What s an API? Do we need standardization? z The socket interface is the
More informationCSMC 412. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala Set 2. September 15 CMSC417 Set 2 1
CSMC 412 Computer Networks Prof. Ashok K Agrawala 2015 Ashok Agrawala Set 2 September 15 CMSC417 Set 2 1 Contents Client-server paradigm End systems Clients and servers Sockets Socket abstraction Socket
More informationVP Verteilte Informationssysteme Message Based Communication Socket Basics
VP Verteilte Informationssysteme Message Based Communication Socket Basics Hilmar Linder hlinder@cosy.sbg.ac.at www.cosy.sbg.ac.at/~hilmar Hilmar Linder 1 Contents Message Oriented Communication The Client-Server
More informationSTUDY OF SOCKET PROGRAMMING
STUDY OF SOCKET PROGRAMMING Sockets : An application programming interface(api) used for inter process communication. Sockets allow communication between two different processes on the same or different
More informationCSE/EE 461 Lecture 14. Connections. Last Time. This Time. We began on the Transport layer. Focus How do we send information reliably?
CSE/EE 461 Lecture 14 Connections Last Time We began on the Transport layer Focus How do we send information reliably? Topics ARQ and sliding windows Application Presentation Session Transport Network
More informationCSC209H Lecture 9. Dan Zingaro. March 11, 2015
CSC209H Lecture 9 Dan Zingaro March 11, 2015 Socket Programming (Kerrisk Ch 56, 57, 59) Pipes and signals are only useful for processes communicating on the same machine Sockets are a general interprocess
More informationNetworked Applications: Sockets. Goals of Todayʼs Lecture. End System: Computer on the ʻNet. Client-server paradigm End systems Clients and servers
Networked Applications: Sockets CS 375: Computer Networks Spring 2009 Thomas Bressoud 1 Goals of Todayʼs Lecture Client-server paradigm End systems Clients and servers Sockets and Network Programming Socket
More informationOverview. Administrative. * HW# 5 Due next week. * HW# 5 : Any Questions. Topics. * Client Server Communication. * 12.
Overview Administrative * HW# 5 Due next week * HW# 5 : Any Questions Topics * Client Server Communication * 12.3 ISO/OSI Layers * 12.4 UICI Implementations * App. B (UICI : Socket Implementation) * 12.4
More informationSystems software design NETWORK COMMUNICATIONS & RPC SYSTEMS
Systems software design NETWORK COMMUNICATIONS & RPC SYSTEMS outline network programming BSD/POSIX Socket API RPC systems object-oriented bridges CORBA DCOM RMI WebServices WSDL/SOAP XML-RPC REST network
More informationIntroduction to Berkeley Sockets
INF1060: Introduction to Operating Systems and Data Communication Data Communication: Introduction to Berkeley Sockets Michael Welzl (adapted from lectures by Pål Halvorsen, Carsten Griwodz & Olav Lysne)
More informationIntroduction to Socket Programming
UNIT II - ELEMENTARY TCP SOCKETS Introduction to Socket Programming Introduction to Sockets Socket address Structures Byte ordering functions address conversion functions Elementary TCP Sockets socket,
More informationC Structures in Practice
CS 2060 Use of C Structures in Unix/Linux To further illustrate C structures, we will review some uses of struct in system calls. Here is a function from BSD to get the current time (found in sys/time.h):
More informationSocket Programming. What is a socket? Using sockets. Types (Protocols) Associated functions Styles
Socket Programming What is a socket? Using sockets Types (Protocols) Associated functions Styles We will look at using sockets in C Note: Java and C# sockets are conceptually quite similar 1 What is a
More informationEEC-484/584 Computer Networks
EEC-484/584 Computer Networks Lecture 15 wenbing@ieee.org (Lecture nodes are based on materials supplied by Dr. Louise Moser at UCSB and Prentice-Hall) Outline 2 Review of last lecture The network layer
More informationSocket Programming 2007/03/28
Socket Programming 2007/03/28 Reference W. Richard Stevens, Unix Network Programming 2/e Volume 1,1998 James F. Kurose and Keith W. Ross, "Computer Networks: A Top-Down Approach Featuring the Internet
More informationIntroduction to Berkeley Sockets
INF1060: Introduction to Operating Systems and Data Communication Data Communication: Introduction to Berkeley Sockets Michael Welzl (revised by Hans Petter Taugbøl Kragset 2015) (adapted from lectures
More informationUnix Network Programming Chapter 4. Elementary TCP Sockets 광운대학교컴퓨터과학과 정보통신연구실 석사과정안중현
Unix Network Programming Chapter 4. Elementary TCP Sockets 광운대학교컴퓨터과학과 정보통신연구실 석사과정안중현 4.1 Introduction A Time line of the typical scenario that takes place between a TCP client and server. Describes the
More informationELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition
ELEC / COMP 177 Fall 2014 Some slides from Kurose and Ross, Computer Networking, 5 th Edition Project #1 Starts in one week Is your Linux environment all ready? Bring your laptop Work time after quick
More information