03-lab1-slides - CS 260 Computer Networks Lab 1 Basic Chat...

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

View Full Document Right Arrow Icon
CS 260: Computer Networks Lab 1: Basic Chat Client
Background image of page 1

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

View Full DocumentRight Arrow Icon
The Lab Write an extremely basic chat client All the “plumbing” is in place, you just need to add the Winsock calls Uses console IO Send and receive chat messages via UDP broadcasts
Background image of page 2
Building Create empty General Empty project Add lab-1.cpp to project, download it from http://www.digipen.edu/~xhou/cs260 Link with WS2_32.LIB
Background image of page 3

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

View Full DocumentRight Arrow Icon
Constants // Constants const unsigned short PORT = 8003; const unsigned MAX_USERNAME = 32; const unsigned MAX_MESSAGE_LEN = 1000; const char MESSAGE_MARKER[] = "CS260"; const char USERNAME_PROMPT[] = "Enter your name> "; const char MESSAGE_PROMPT[] = "> "; const unsigned BUFFER_LEN = sizeof( MESSAGE_MARKER ) + MAX_USERNAME + sizeof( MESSAGE_PROMPT ) + MAX_MESSAGE_LEN; const char* QUIT = "/quit";
Background image of page 4
// Helper function void ErrorCheck( const char* strFunction ) { // Retrieve the Winsock error code int nErr = WSAGetLastError(); // WSAEWOULDBLOCK is benign; ignore it if( nErr == WSAEWOULDBLOCK )
Background image of page 5

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

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

Page1 / 10

03-lab1-slides - CS 260 Computer Networks Lab 1 Basic Chat...

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

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