From the course: Network Programming in C: Develop Reliable Client/Server Applications

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Challenge: Write a chat server

Challenge: Write a chat server

(gentle music) - [Instructor] The final challenge for this course requires some heavy lifting. Code a chat server. The server must accept and manage multiple client connections. Text received from a client is shared with all the clients and echoed to the server. This description is simple, but the task is major. To show you how it works, I'll run the client to connect with a server running elsewhere on my office network. The server welcomes me and echoes my local network IP address. This becomes my ID on the chat server. The server echos back my input. There is no input prompt, and other clients already connected see this computer's IP and the text I sent. Here come their replies. You see others on the network and their IP addresses, plus, any text they've sent. You see when another user has disconnected. And you see when they've reconnected. Type close by itself to disconnect. Here's the client code which…

Contents