Ά η η 1 (30%): Sockets. socket () bind () listen () accept () connect () read () write () close ()
|
|
- Joel Quinn
- 5 years ago
- Views:
Transcription
1 ΗΜΥ Ε α η ια ή Ά η η 5 Υ ο οίη η Π ω ο ό ο α η αι α α ο ή sockets Ά η η 1 (30%): Sockets π α α α α α π πα π α α ω sockets Unix/Linux. Γ α α α π π α π α Server α Client π π π α έ Α π, α α απ π ω. socket () bind () listen () accept () connect () read () write () close () Ά η η 2 (70%): Π ω ό ο ο αύ η αι α α ο ή π α α α π π ω πα α α α (Stop and wait protocol) α π α α C π α sockets. Θα α α π α απ α (Transmitter) α πα α π (Receiver) π α π ω ω α π α α ( α α α α α α )έ α, απ α α α α α α απ π α α απ ( α α α α ) πα α π α α έ πα α π α π ω α α (π π α απ π π π α α ) απ α (Socket π Client non blocking mode) α α α (channel) port 4610 (server port = 4610) α α α α πα α π (Socket π Server - non blocking mode) port 4613 (Receiver port = 4613). απ α α α α α α ω απ π α α απ α, α α α α έ π α απ α α β α α ω έ π α α α α α sequence number (0 1) α α α αέ Γ α πα α α α α απ π α α format pkt0=0,ch or pkt1=1,ch π ch α α α α έ
2 α π α α απ frame α ω α ( α α π CRC). Η α π π α π α 1,β π αέ πα α π α π α π ω α π απ απ α α α απα α Acknowledgment (ACK). α α ακ Ο ώ ι α αι η α αφο ά ι α π akyria09@ucy.ac.cy charalampos.menelaou@ucy.ac.cy π, 25 Φ α βί1ζ π αέ κ α(subject) π π α π ECEγ1ζ_βί1ζ έ α α α π π α π α α έzip α α Assignment5_name_surname έ
3 Server #include <sys/types.h> #include <sys/time.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <unistd.h> #include <errno.h> #include <signal.h> #include <stdio.h> static void serve(int); #define PORT 6060 main( int argc, char **argv ) int lsd; /* Listening socket */ struct sockaddr_in sin; /* Binding struct */ int sin_size=sizeof(sin); int sd; /* Socket to accept new connexion */ /* Create listening socket */ if ( (lsd=socket(af_inet, SOCK_STREAM, 0)) < 0 ) fprintf(stderr, "%s: cannot create listening socket: ", argv[0]); sin.sin_family = AF_INET; sin.sin_port = htons(port); sin.sin_addr.s_addr = htonl(inaddr_any); if ( bind(lsd, &sin, sin_size) < 0 ) fprintf(stderr, "%s: cannot bind listening socket: ", argv[0]); /* Initiate a listen queue */ if ( listen(lsd, 5) < 0 ) fprintf(stderr, "%s: cannot listen on socket: ", argv[0]);
4 /* Take care of the SIGPIPE signal - ignore it */ signal(sigpipe, SIG_IGN); while ( 1 ) if ( (sd=accept(lsd, &sin, &sin_size)) < 0 ) exit(errno); serve(sd); shutdown(sd, 2); close(sd); void serve(int sd) time_t local_time; char *time_string; time(&local_time); time_string = ctime(&local_time); write(sd, time_string, strlen(time_string)); return;
5 Client #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define BUFSIZE 1024 #define SERVER_PORT 6060 main( int argc, char **argv ) int sd; /* Socket descriptor */ struct sockaddr_in server; /* Server to connect */ struct hostent *server_host; /* Host info */ char buf[bufsize]; int nbytes; /* Create socket */ if ( (sd=socket(af_inet, SOCK_STREAM, 0)) < 0 ) fprintf(stderr, "%s: cannot create socket: ", argv[0]); /* Get info on host */ if ( (server_host=gethostbyname(argv[1])) == NULL ) fprintf(stderr, "%s: unknown host %s\n", argv[0], argv[1]); /* Set up struct sockaddr_in */ server.sin_family = AF_INET; server.sin_port = SERVER_PORT; bcopy((char*)server_host->h_addr, (char*)&server.sin_addr, server_host->h_length); /* Connect */ if ( connect(sd, &server, sizeof(server)) < 0 ) fprintf(stderr, "%s: cannot connect to server: ", argv[0]); /* Get date */ if ( (nbytes=read(sd, buf, BUFSIZE-1)) <= 0 ) fprintf(stderr, "%s: read failed: ", argv[0]);
6 buf[nbytes] = 0; printf("date on host %s is: %s\n", argv[1], buf); close(sd); exit(0);
7 #include <sys/types.h> #include <sys/time.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <signal.h> #include <stdio.h> #include <time.h> #include <stdlib.h> Channel #define BUFSIZE 1024 #define PORT 4610 #define SERVER_PORT 4613 double pl,pd,u; main( int argc, char **argv ) int new_sd,sd2,sd3; srand(time(null)); char Rxbuf_from_Rx[BUFSIZE],Rxbuf_from_Tx[BUFSIZE]; int parent,child,nbytes,n1bytes; int channel_delay= ; struct sockaddr_in server; struct hostent *server_host; /* Create socket */ if ( (sd2=socket(af_inet, SOCK_STREAM, 0)) < 0 ) fprintf(stderr, "%s: cannot create socket: ", argv[0]); /* Get info on host */ if ( (server_host=gethostbyname(argv[1])) == NULL ) fprintf(stderr, "%s: unknown host %s\n", argv[0], argv[1]); /* Set up struct sockaddr_in */ server.sin_family = AF_INET; server.sin_port = htons(server_port); bcopy((char*)server_host->h_addr, (char*)&server.sin_addr, server_host->h_length); connect(sd2,(struct sockaddr *)&server, sizeof(server)); struct sockaddr_in in_sa; int in_sa_size = sizeof(in_sa); in_sa.sin_family = AF_INET; in_sa.sin_port = htons(port); in_sa.sin_addr.s_addr = htonl(inaddr_any); if ((new_sd =socket(af_inet,sock_stream,0)) < 0) fprintf(stderr,"%s: cannot create listening socket: ",argv[0]); if(bind (new_sd,(struct sockaddr *)&in_sa,in_sa_size)<0) fprintf(stderr,"%s: cannot bind listening socket: ",argv[0]);
8 // Initialize a listen queque if(listen(new_sd,5)<0) fprintf(stderr, "%s: cannot listen on socket: ",argv[0]); socklen_t len = sizeof(in_sa); if((sd3=accept(new_sd,(struct sockaddr *)&in_sa,&len))<0) signal(sigpipe,sig_ign); printf("\ngive Channel Probability for Loss:"); scanf("%lf",&pl); printf("\ngive Channel Probability for Delay:"); scanf("%lf",&pd); if(fork()==0 ) child=getpid(); while((n1bytes=read(sd2,rxbuf_from_rx,bufsize))>0) Rxbuf_from_Rx[n1bytes] = '\0'; printf("channel Recieved Ack %c from Receiver \n\n", Rxbuf_from_Rx[0]); write(sd3,rxbuf_from_rx,n1bytes); else parent=getppid(); while((nbytes=read(sd3,rxbuf_from_tx,bufsize))>0) Rxbuf_from_Tx[2] = '\0'; printf("channel Recieved from Transmitter: %s\n", Rxbuf_from_Tx); u =1+rand()%100; u=u/100; if (pl>=u) printf("packet %c lost\n", Rxbuf_from_Tx[1]); else if ((pl<u)&&(pd>=u)) printf("packet %c delay for %d microseconds\n", Rxbuf_from_Tx[1], channel_delay); usleep(channel_delay); write(sd2, Rxbuf_from_Tx,nbytes); else if ((pl<u)&&(pd<u)) printf("packet %c send successfully\n", Rxbuf_from_Tx[1]); write(sd2, Rxbuf_from_Tx,nbytes); else printf("unexpected error\n");
CS4514 B08 HELP Session 1
CS4514 B08 HELP Session 1 Presented by Choong-Soo Lee clee01@cs.wpi.edu CS4514 TCP/IP Socket Programming Outline Project 1 Overview Unix Network Programming TCP Client TCP Server Processing commands How
More informationCS4700/CS5700 Fundamentals of Computer Networking
CS4700/CS5700 Fundamentals of Computer Networking Prof. Alan Mislove Lecture 3: Crash course in socket programming September 10th, 2009 Project 0 Goal: Familiarize you with socket programming in C Implement
More informationECE322 Systems Programming Project 2: Networking with Matrix Multiplication in C Grant Kimes 12/16/15
ECE322 Systems Programming Project 2: Networking with Matrix Multiplication in C Grant Kimes 12/16/15 This project take two inputted matrices of a given size to multiply. The client sends the data to a
More informationChapter 2 Applications and
Chapter 2 Applications and ed Architectures Protocols, Services & ing OSI Reference Model TCP/IP Architecture How the s Work Together Berkeley Sockets Application Protocols & Utilities 1 s, Services &
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 Echo Client (1) 2 #include #include #include #include
More information1 /* client.c - adapted from code for example client program that uses TCP */ 2 /*Modified by Vincent Chu, Winter
1 /* client.c - adapted from code for example client program that uses TCP */ 2 /*Modified by Vincent Chu, Winter 2004. 3 http://www.sfu.ca/~vwchu 4 chuvincent (at) gmail (dot) com 5 */ 6 7 #define closesocket
More informationClient software design
Client software design Stefan D. Bruda Winter 2018 A TCP CLIENT 1 Get the IP address and port number of the peer 2 Allocate a socket 3 Choose a local IP address 4 Allow TCP to choose an arbitrary, unused
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 informationThe User Datagram Protocol
The User Datagram Protocol Stefan D. Bruda Winter 2018 UDP Very similar to the TCP in terms of API Dissimilar with TCP in terms of innards (and hence programming techniques) Many-to-many communication.
More informationl27 handout.txt buggy server.c Printed by Michael Walfish Apr 29, 10 13:41 Page 1/1 Apr 29, 10 11:51 Page 1/1
Apr 29, 10 13:41 Page 1/1 1 Handout for CS 372H 2 Class 27 3 29 April 2010 4 5 1. Introduction to buffer overflow attacks 6 7 There are many ways to attack computers. Today we study the 8 "classic" method.
More informationProgramming Requirements. Project & Programming Overview. Local Repository SVN 1/10/2011. Version Control: SVN Makefiles Development Language: C only
Programming Requirements Project & Programming Overview Version Control: SVN Makefiles Development Language: C only 18-345 Spring 2011 Local Repository SVN To create a repository: svnadmin create --fs-type
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 informationPiotr Mielecki Ph. D.
Piotr Mielecki Ph. D. http://mielecki.ristel.pl/ piotr.mielecki@pwr.edu.pl pmielecki@gmail.com Building blocks of client-server applications: Client, Server, Middleware. Simple client-server application:
More informationSystem Programming. Sockets: examples
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 Socket based client/server
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 informationMessage passing systems are popular because they support client-server interactions, where: clients send messages to servers requesting a server.
Client-Server Model Message passing systems are popular because they support client-server interactions, where: clients send messages to servers requesting a server. servers provide services requested
More informationCompSci 356: Computer Network Architectures Lecture 3: Hardware and physical links References: Chap 1.4, 1.5 of [PD] Xiaowei Yang
CompSci 356: Computer Network Architectures Lecture 3: Hardware and physical links References: Chap 1.4, 1.5 of [PD] Xiaowei Yang xwy@cs.duke.edu Overview Lab overview Application Programming Interface
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 informationApplication Programming Interfaces
Application Programming Interfaces Stefan D. Bruda Winter 2018 SYSTEM CALLS Machine 1 Machine 2 Application 1 Application 3 Application 4 Application 5 Application 2 API (system functions) API (system
More informationl27 handout.txt buggy server.c Printed by Michael Walfish Apr 28, 11 15:24 Page 1/1 Apr 27, 11 1:53 Page 1/2
Apr 28, 11 15:24 Page 1/1 1 Handout for CS 372H 2 Class 27 3 28 April 2011 4 5 1. Introduction to buffer overflow attacks 6 7 There are many ways to attack computers. Today we study the 8 "classic" method.
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 informationCracking WEP Keys Using WEPCrack
Appendix E Cracking WEP Keys Using WEPCrack This appendix describes an experiment to crack a WEP-protected WLAN using WEPCrack, an open-source WEP cracking tool. WEPCrack implements the RC4 weak-key attack
More informationNetwork Programming Worksheet 2. Simple TCP Clients and Servers on *nix with C.
Simple TCP Clients and Servers on *nix with C. Aims. This worksheet introduces a simple client and a simple server to experiment with a daytime service. It shows how telnet can be used to test the server.
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 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 informationCS307 Operating Systems Processes
CS307 Processes Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2018 Process Concept Process a program in execution An operating system executes a variety of
More informationProcesses. Process Concept. The Process. The Process (Cont.) Process Control Block (PCB) Process State
CS307 Process Concept Process a program in execution Processes An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks All these activities are
More informationSockets Sockets Communication domains
Sockets Sockets The original method for process communication in UNIX is pipes. A disadvantage with pipes is that they can only be used by processes that have the same parent process. When communicating
More informationIntroduction to Client-Server Model
Preview Introduction to Client-Server Model Motivation of Client-Server Model Terminologies and Concepts in Client-Server Model Connectionless vs. Connection-Oriented Stateless vs. Stateful Server Identify
More informationAzblink API for Sending XMPP Messages via HTTP POST
Azblink API for Sending XMPP Messages via HTTP POST Abstract: This document is to describe the API of Azblink SBC for sending XMPP messages via HTTP POST. This is intended for the systems or the devices
More informationNETWORK AND SYSTEM PROGRAMMING. I/O Multiplexing: select and poll function
NETWORK AND SYSTEM PROGRAMMING LAB 15 I/O Multiplexing: select and poll function 15.1 objectives What is a Concurrent server Use of Select System call Use of Poll System call 15.2 What is concurrent server?
More informationSockets. 1 Introduction. (Reference:, Gray Chapter 10) Network Programming Lecture Notes by. Turhan TUNALI
Sockets (Reference:, Gray Chapter 10) Network Programming Lecture Notes by 1 Introduction Turhan TUNALI Unix uses a common interface for the access of files and devices that reside on a single host. The
More informationUDP CONNECT TO A SERVER
UDP The User Datagram Protocol Stefan D. Bruda Winter 2018 Very similar to the TCP in terms of API Dissimilar with TCP in terms of innards (and hence programming techniques) Many-to-many communication.
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 informationCompSci 356: Computer Network Architectures. Lecture 3: Network Architecture Examples and Lab 1. Xiaowei Yang
CompSci 356: Computer Network Architectures Lecture 3: Network Architecture Examples and Lab 1 Xiaowei Yang xwy@cs.duke.edu Overview The Internet Architecture OSI Network Architecture Lab 1 Released Due:
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 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 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 informationICT 6544 Distributed Systems Lecture 5
ICT 6544 Distributed Systems Lecture 5 Hossen Asiful Mustafa Message Brokers Figure 4-21. The general organization of a message broker in a message-queuing system. IBM s WebSphere Message-Queuing System
More informationHow to write a Measurement Telnet Server
How to write a Measurement Telnet Server A measurement Telnet server allows you to access remote I/Os with a standard Telnet client program. The following samples shows a way to set the LEDs of a DNP/EVA1
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 informationCS4514 (C04) HELP Session 1 Introduction to Network Programming (v1.3)
CS4514 (C04) HELP Session 1 Introduction to Network Programming (v1.3) Speaker: Frank Posluszny Outline! Project 1 Overview! Unix Network Programming Client Server Communication with netoracle! Project
More informationINTEGRATED INFORMATION AND COMMUNICATION LEARNING MODEL FOR RASPBERRY Pi ENVIRONMENT
INTEGRATED INFORMATION AND COMMUNICATION LEARNING MODEL FOR RASPBERRY Pi ENVIRONMENT Y. J. Lee Department of Technology Education, Korea National University of Education, South Korea E-Mail: lyj@knue.ac.kr
More informationCSCI 415 Computer Networks Homework 2 Due 02/13/08
CSCI 415 Computer Networks Homework 2 Due 02/13/08 Saad Mneimneh Computer Science Hunter College of CUNY Problem 1 Consider the following server and client C++ code that we saw in class: server.c #include
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 informationThe Transport Layer. The need for the transport layer
The Transport Layer Aims To explain:- The need for the transport layer A simple exemplar Transport in IP and ATM Outcomes To understand the need for the layer and the solution adopted adopted when internetworking
More informationLinux Network Programming, Part 1
Linux Network Programming, Part 1 http://www.linuxjournal.com/article/2333?page=0,0 Feb 01, 1998 By Ivan Griffin and John Nelson This is the first of a series of articles about how to develop networked
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 informationPage 1 of 8 [ Team LiB ] 6.1 The Transport Service In the following sections we will provide an introduction to the transport service. We look at what kind of service is provided to the application layer.
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 informationClient/Server. Networking Approach.
Client/Server Networking Approach andrei.doncescu@laas.fr CLIENT/SERVER COMPUTING (THE WAVE OF THE FUTURE) OBJECTIVES Goal: How application programs use protocol software to communicate across networks
More informationSockets. UNIX-style IPC. Silberschatz, Galvin and Gagne 2005 Msc. Ivan A. Escobar Broitman 2007
UNIX-style IPC Silberschatz, Galvin and Gagne 2005 Msc. Ivan A. Escobar Broitman 2007 Introduction to A socket is one of the most fundamental technologies of computer networking. The socket is the BSD
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 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 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 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 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 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 information// Embedded Systems // BeagleBoard-XM. // Author : Jose Goncalves //
// Embedded Systems // BeagleBoard-XM // Author : Jose Goncalves // jose.braga.pt@gmail.com // Teacher : Nuno Peixoto // University : IPCA // 17.03.2014 #include #include #include
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 information// socket for establishing connections
#include #include #include #include #include #include #include #define FILELENGTH 511 // This is not right #define
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 informationProject 3. Reliable Data Transfer over UDP. NTU CSIE Computer Networks 2011 Spring
Project 3 Reliable Data Transfer over UDP NTU CSIE Computer Networks 2011 Spring Project Goal In Project 3, students are asked to understand and implement reliable data transfer mechanism over UDP. UDP
More informationInterprocess Communication Mechanisms
Interprocess Communication 1 Interprocess Communication Mechanisms shared storage These mechanisms have already been covered. examples: shared virtual memory shared files processes must agree on a name
More informationInterprocess Communication
Interprocess Communication Dr. Xiaobo Zhou Adopted from Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, Addison-Wesley 2005 1/14/2008 1 Middleware Layers Applications,
More informationInterprocess Communication Mechanisms
Interprocess Communication 1 Interprocess Communication Mechanisms ffl shared storage These mechanisms have already been covered. examples: Λ shared virtual memory Λ shared files processes must agree on
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 informationDistributed programming
Distributed programming Previously discussed Every SCC is a component in a distributed system that executes distributed programs on a combination of the SCC and one or more other machines. Physically distributed
More informationClient-server model The course that gives CMU its Zip! Network programming Nov 27, Using ports to identify services.
15-213 The course that gives CMU its Zip! Network programming Nov 27, 2001 Topics Client- model Sockets interface Echo and Client- model Every network application is based on the - model: Application is
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 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 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 informationTCP Echo Application: Client & Server. TA: Awad A Younis Class: CS457 Fall 2014
TCP Echo Application: Client & Server TA: Awad A Younis Class: CS457 Fall 2014 Outline Echo Server TCP-Client TCP-Server 2 Echo Server The server simply echo whatever it receives back to the client Echo:
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 informationCSC Systems Programming Fall Lecture - XV Network Programming - I. Tevfik Ko!ar. Louisiana State University. November 9 th, 2010
CSC 4304 - Systems Programming Fall 2010 Lecture - XV Network Programming - I Tevfik Ko!ar Louisiana State University November 9 th, 2010 1 Network Programming 2 Sockets A Socket is comprised of: a 32-bit
More informationAn Introductory 4.4BSD Interprocess Communication Tutorial Stuart Sechrest Computer Science Research Group Computer Science Division Department of Electrical Engineering and Computer Science University
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 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 informationCSE 333 SECTION 8. Sockets, Network Programming
CSE 333 SECTION 8 Sockets, Network Programming Overview Domain Name Service (DNS) Client side network programming steps and calls Server side network programming steps and calls dig and ncat tools Network
More informationCSE 421/521 - Operating Systems Fall 2011 Recitations. Recitation - III Networking & Concurrent Programming Prof. Tevfik Kosar. Presented by...
CSE 421/521 - Operating Systems Fall 2011 Recitations Recitation - III Networking & Concurrent Programming Prof. Tevfik Kosar Presented by... University at Buffalo September..., 2011 1 Network Programming
More informationHow to write a Measurement Telnet Server
How to write a Measurement Telnet Server A measurement Telnet server allows you to access remote I/Os with a standard Telnet client program. The following samples shows a way to set the LEDs of a DNP/EVA2
More informationSocket 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 informationINF 2005 Programmation orientée objet avec C++
INF 2005 Programmation orientée objet avec C++ Module 5 - Solutions 1. #include #include double *s_ltab; long ltab_n; void Sommation(double b) double l1b = 1.0 / log(b); double s = 1.0;
More informationSignal Example 1. Signal Example 2
Signal Example 1 #include #include void ctrl_c_handler(int tmp) { printf("you typed CTL-C, but I don't want to die!\n"); int main(int argc, char* argv[]) { long i; signal(sigint, ctrl_c_handler);
More informationConcurrent Servers. Overview. In our current assignment we have the following changes:
Concurrent Servers Overview In our current assignment we have the following changes: Concurrent server Session command with an argument of the session name Shutdown command 2 Concurrent Server When a client
More information2.2 IoT Internet of Things Android Studio
Sana 1 1... 3 1.1... 3 1.2... 4 2... 5 2.1... 5 2.2 IoT Internet of Things... 5 2.3... 5 2.4... 6 2.5 IoT a cfr... 6... 7 3.1... 7 3.2... 8 3.3 LAN... 10 4... 11 4.1 Android Studio... 11 4.2... 11 4.3
More informationint write (int fd, void *buf, int nbytes); write will write up to nbytes bytes of data at buf to le descriptor fd. It returns the number of bytes actu
Using TCP Through Sockets David Mazieres dm@amsterdam.lcs.mit.edu 1 File descriptors Most I/O on Unix systems takes place through the read and write system calls 1. Before discussing network I/O, it helps
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 informationchat.h #ifndef _CHAT_H #define _CHAT_H #define LBUFFSIZE 128 #define CBUFFSIZE 331
chat.h #ifndef _CHAT_H #define _CHAT_H #define LBUFFSIZE 128 #define CBUFFSIZE 331 #define INCRSLOT(V) { \ ++(V) ; \ if ((V) >= CBUFFSIZE) \ (V) = 0 ; \ enum Lstates {UNUSED, MESSAGE ; struct linebuff
More informationCSE 333 SECTION 7. Client-Side Network Programming
CSE 333 SECTION 7 Client-Side Network Programming Overview Domain Name Service (DNS) Client side network programming steps and calls dig and ncat tools Network programming for the client side Recall the
More informationDept. of Computer Science & Engineering 1 Knowledge & Data Engineering Lab.
Socket Programming Dept. of Computer Science & Engineering 1 Socket A socket is a communication end point. Is equivalent to a computer s network (hardware) interface. Allows a network application to plug
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 informationInterprocess Communication. Interprocess Communication
Interprocess Communication Interprocess Communication The original UNIX systems had pipes as the only interprocess communication method. An improved interprocess communications interface was designed for
More informationCSE 333 SECTION 7. C++ Virtual Functions and Client-Side Network Programming
CSE 333 SECTION 7 C++ Virtual Functions and Client-Side Network Programming Overview Virtual functions summary and worksheet Domain Name Service (DNS) Client side network programming steps and calls dig
More informationInternet protocol stack. Internetworking II: Network programming. April 20, UDP vs TCP. Berkeley Sockets Interface.
15-213 Internetworking II: Network programming Berkeley sockets interface Internet protocol stack April 20, 2000 Topics client/server model Berkeley sockets TCP client and server examples UDP client and
More informationInternetworking II: Network programming. April 20, 2000
15-213 Internetworking II: Network programming Topics April 20, 2000 client/server model Berkeley sockets TCP client and server examples UDP client and server examples I/O multiplexing with select() Internet
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 informationPractical Exercises in Computer Networks
Practical Exercises in Computer Networks Wall clock time in Distributed Systems 2015-16 by José María Foces Morán 1. Wall clock time and the ICMP protocol One of the functions of the icmp protocol allows
More information#1 socket_server.c socket_client.c
Subsections ConectingStreamSockets 07-08-2005 S StreamDataTransferandClosing ocketcreationandnaming http://www.cs.cf.ac.uk/dave/c/node28.html#section002800000000000000000 #1 SocketOptions Datagramsockets
More information