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 - C Tutorial
From the course: Network Programming in C: Develop Reliable Client/Server Applications
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.