Daniel Gurianov wrote:I `m struggling with homework task to create multiuser console chat program...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ulf Dittmer wrote:That while loop is a common idiom of network servers, which are supposed to run forever after all, so that looks OK to me.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Second part of the task is to convert this chat into single threaded application.
How this can be done?
Ulf Dittmer wrote:That while loop is a common idiom of network servers, which are supposed to run forever after all, so that looks OK to me.
As to your question, I'm confused - if all clients are "waiting", not doing anything, there will be nothing to show. Only once a client sends a message will there be anything to display. Am I misunderstanding your question?
Essentially you have to make that one Thread multi-task - here is a sketch
while (running) {
1 - wait for the text user enters, after enter pressed, get data.
Ulf Dittmer wrote:That while loop is a common idiom of network servers, which are supposed to run forever after all, so that looks OK to me.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Don't get me started about those stupid light bulbs. |