hw1 - CSCI 415 Computer Networks Homework 1 Due 02/04/08...

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

View Full Document Right Arrow Icon
CSCI 415 Computer Networks Homework 1 Due 02/04/08 Saad Mneimneh Computer Science Hunter College Problem 1 Listen to the first movement of Beethoven’s fifth symphony. Problem 2 Write the following sentence in Morse code: “I am in the CSCI 415 class.” Problem 3 Compile the following server and client C++ code and run it. You will be asked to modify the code in a later homework. server.c #include <iostream> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> using std::cout; using std::cin; const unsigned short int port = 5432; const int max_pending = 10; const int max_len = 256; int main() { sockaddr_in address; //address sockaddr_in client_address; //client address char message[max_len]; int s; int new_s; int len;
Background image of page 1

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

View Full DocumentRight Arrow Icon
//build address memset(&address, 0, sizeof(address)); address.sin_family = AF_INET; address.sin_addr.s_addr = htonl(INADDR_ANY); address.sin_port = htons(port); //setup passive open if ((s=socket(PF_INET, SOCK_STREAM, 0)) < 0) { cout<<"error in socket";
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

hw1 - CSCI 415 Computer Networks Homework 1 Due 02/04/08...

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

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