taskhowto - CSE 422 Lab 3: Task How-To You will need to...

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

View Full Document Right Arrow Icon
CSE 422 Lab 3: Task How-To You will need to edit both the server and client In the server code: Add an member variable to the struct user object near the top of the file: sockaddr_in address; (This will be used to store the address of the client represented by the address.) In connect(void *) function add: newuser->addr = client; After the line user newuser = new user(); Finally we need to add a UDP message to the client when we are done sending. In the image_message(void *c) function add the following two lines: int x = 0; sendto(udp_fd, &x, sizeof(x), 0,(struct sockaddr*)&(client->address), sizeof(client->address)); In the client code: Add the line #include <sys/time.h> to the list of includes. Find the line "close(udp_fd);" and comment it out.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Now we need to time the time it takes to send an image: Before the line: write(image_tcp, &img, sizeof(img)); Add: timeval t1, t2; gettimeofday(&t1, NULL); This will get the current time and store it into t1; Then after the line: write(image_tcp, buf+tot, len-tot);
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 / 3

taskhowto - CSE 422 Lab 3: Task How-To You will need to...

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