lab3 - CSE 422 Lab 3: Sending Image Files in a Chat Room...

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

View Full Document Right Arrow Icon
CSE 422 Lab 3: Sending Image Files in a Chat Room Overview: As in Lab 2, the general application is that of a chat room, where clients connect to a server and can communicate with each other. Now we want you to add the ability for a client to send an image to the other clients and have it displayed. To display, you will simply launch qiv, a “quick image viewer.” We have supplied a solution for the Lab 2 that you will need to use. You will need to download:, and lab3_packet.h and the makefile. These will compile and run with the capabilities of Lab 2. Note: make sure you recompile the client, because it has been improved since the version distributed with Lab 2. Please follow the steps to begin this lab. There is a task at the end of the lab. Note: You must run and compile these applications using Linux. is a Linux based server and there are about 15 Linux machines in the Simpson Lab (3353). We strongly suggest trying to find a way to use two different computers for the client and server, but using localhost for the server address will work if you are using the same machine to run both client and server (by opening two terminals). If you are using two different machines in the Simpson Lab, they can be addressed by the computer name listed on the machine and on the terminal prompt. Step 1: Creating a new TCP connection per user We want to create a new TCP connection for sending the image, to separate sending images and sending text. In the config() function, we need to: Create the socket: if ((image_fd = socket(AF_INET,SOCK_STREAM,0))<0) { cerr << "image_fd tcp error!" << endl; return false ; } Bind the Socket: sockaddr_in server_image; server_image.sin_family = AF_INET; // internet family server_image.sin_port = 0; // get the socket port server_image.sin_addr.s_addr = INADDR_ANY; // wild card machine address
Background image of page 1

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

View Full DocumentRight Arrow Icon
if ((bind(image_fd,(
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 / 6

lab3 - CSE 422 Lab 3: Sending Image Files in a Chat Room...

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