Computing.Net > Forums > Networking > Writing A Server

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Writing A Server

Reply to Message Icon

Name: Chad Johnson (by ChadJohnson)
Date: September 27, 2004 at 19:51:22 Pacific
OS: n/a
CPU/Ram: n/a
Comment:

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?



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Network with 2 routers Workgroup issues on switc...



Post Locked

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


Go to Networking Forum Home


Sponsored links

Ads by Google


Results for: Writing A Server

Adding a server over wifi network www.computing.net/answers/networking/adding-a-server-over-wifi-network/31742.html

adding a server www.computing.net/answers/networking/adding-a-server/25441.html

A server 2nd opinion www.computing.net/answers/networking/a-server-2nd-opinion/24186.html