Lecture13-Networking%20Intro

Lecture13-Networking%20Intro - ComputerSystems...

Info icon This 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
Image of page 1

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

View Full Document Right 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
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
Image of page 3

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

View Full Document Right 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
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     //create new comm channel to  client     //create detached thread to  handle client } //thread     //handle client     //close fd for client comm  channel     //exit
Image of page 5

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern