Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I've been messing around with socket programming lately, and I've realized that there are two possible ways to write a server.
One, with Java, you can say something like
SocketServer server = new SocketServer (port);
Socket client;while (true)
{
client = server.accept ();if (client != null)
// do something
}However, I've been using wxWidgets, and I looked at their socket libraries, and they differently. The program doesn't have to sit in a loop and wait for connections. Rather, whenever the server gets any activity on the port it calls a function that you define. This, in my mind, is just like interrupt programming.
Which of these two ways is best? Which should I use? What are the advantages and disadvantages?

![]() |
Network with 2 routers
|
Workgroup issues on switc...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |