Network programming is outside the scope of the VC forums. If network programming were valid for these forums then I would say more, except since the subject is covered as much as it is elsewhere, it is foolish to spend time saying much about it. There ae already ample great resources about network programming.
There are important fundamental concepts that are common to many things, not just network programming. Concepts such as multithreading, asynchronous i/o and events. Events are critical to a UI system such as Windows and the ones used by Linux/Unix. Sleep is a very simple way for a program to yield for otehr processing, but it is so simple that it does not allow other events to be processed for a message loop. The Message Loop is central to the way that a Windows program works and understanding it will help to understand why Sleep is not the best solution. Yes for a Windows program a Message Loop is just a relatively simple while loop but Sleep is not used in a Message Loop.
Even if you were to write a console program without a Message Loop, network programming ususally uses events and threads to do I/O. There are abundant resources explaining that and much more.
You don't need us to help you with that. I am volunteering my time and you already have had the benefit of my time. I am more interested in helping people that really need help in the sense that the questions they ask are not easily answered. For the question of how to do network programming, there are plenty of places that answer that question that you can easily find, but it would require too much of my time to provide the same answers that you can easily find.
|