lecture3 - CS4700/CS5700 Fundamentals of Computer...

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

View Full Document Right Arrow Icon
CS4700/CS5700 Fundamentals of Computer Networking Prof. Alan Mislove Lecture 3: Crash course in socket programming September 10th, 2009
Background image of page 1

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

View Full DocumentRight Arrow Icon
10.09.2009 CS4700/CS5700 Lecture 2 Alan Mislove Project 0 Goal: Familiarize you with socket programming in C Implement a trivial/useless protocol We have a server; you write the client If you know C, it will take 5 minutes If you don’t, it will take 30 2
Background image of page 2
10.09.2009 CS4700/CS5700 Lecture 2 Alan Mislove client.c stub code We provide stub code Does all necessary incantations You fll in the interesting bits Should be 5-10 lines Rest oF lecture: code walk Explain the (interesting) incantations 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
10.09.2009 CS4700/CS5700 Lecture 2 Alan Mislove Includes (1) #include <stdio.h> (2) #include <string.h> #include <unistd.h> (3) #include <sys/types.h> (4) #include <stdlib.h> (5) #include <sys/socket.h> (6) #include <netinet/in.h> (7) #include <arpa/inet.h> (8) #include <netdb.h> (10)#include "common.h" 4
Background image of page 4
10.09.2009 CS4700/CS5700 Lecture 2 Alan Mislove #defnes (11)#define pAssert(a,b) { if (!(a)) { printf("Line %d in File %s: %s\n", __LINE__, __FILE__, b); exit(1); } } (12)#define pError(e,a) { if (e) { perror(a); exit(1); } } 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
CS4700/CS5700 Lecture 2 Alan Mislove main (13) struct sockaddr_in sin; (14) struct hostent *h; (15) int sd; (17) h = (argc > 2) ? gethostbyname(argv[1]) :
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/04/2011 for the course CS 4700 taught by Professor Mislove during the Spring '11 term at Northeastern.

Page1 / 15

lecture3 - CS4700/CS5700 Fundamentals of Computer...

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

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