Lecture13-Networking%20Intro

Lecture13-Networking%20Intro - CSCE313Introductionto...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCE 313 Introduction to  Computer Systems Instructor: Dr. Ronnie Ward Based on material from Dr. Riccardo Bettati
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Network Programming Network Programming as Programming across Machine  Boundaries The  Sockets  API Reliable Communication Channels:  TCP Dangerous at any Speed; connectionless communication and  UDP Client/Server Paradigm  Reading: R&R, Ch 18
Background image of page 2
Need for Protocols Protocols are a set of rules and conventions . By enforcing communicating  parties to adhere to a common protocol,  communication is made possible.  3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chp 6 Example: Client-Server Interaction /* SERVER PROGRAM */ int main(int argc, char ** argv) { int requestfd; string fifoname = argv[1]; /* -- CREATE NAMED PIPE */ mkfifo (fifoname, FIFO_PERMS); /* -- OPEN READ/WRITE ENDPOINT TO PIPE */ requestfd = open (fifoname, O_RDWR)); /* -- WRITE INCOMING INFO TO STDOUT. */ copy_file(requestfd, STDOUT_FILENO); } What  protocol  is followed that enables  communication? Question? /* CLIENT PROGRAM */ int main(int argc, char ** argv) { int requestfd; string fifoname = argv[1]; /* -- OPEN READ/WRITE ENDPOINT TO PIPE */ requestfd = open (fifoname, O_WRONLY)); log_info = generate_some_log_info; /* -- SEND LOG INFO TO SERVER PROGRAM */ r_write (requestfd, log_info); r_close (requestfd); } Client and server are on  the same machine Comm channel is the  named pipe O.S. file system is the  underlying conduit
Background image of page 4
Server Strategies Parent-Server Strategy //parent for( ; ; ) {     //listen for a client request     //create new comm channel to    client     //fork a child to handle client     //close fd for new comm channel     //zombie cleanup } //child     //close fd for listening channel     //handle client     //close fd for client comm  channel     //exit Threaded-Server Strategy //parent for( ; ; ) {     //listen for a client request
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/14/2012 for the course CSCE 313 taught by Professor Gu during the Spring '11 term at Texas A&M.

Page1 / 27

Lecture13-Networking%20Intro - CSCE313Introductionto...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online