Jump to content
  • Advertisement
Sign in to follow this  
Kryptus

Network Loop Problem

This topic is 4747 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using Visual C# 2005 Beta 2 to make a simple server with a tray icon. The server is in a data loop of mine receiving data from clients but during this time (which is the entire time the program is running) I can't access the tray icon. It appears and has a balloon but if I right click it nothing happens. But as soon as the loop stops the menu appears. How do I get around this problem without compromising my loop?

Share this post


Link to post
Share on other sites
Advertisement
If your network loop is using blocking I/O, create a separate thread that contains your data loop. Your current program is probably blocking on listening for network traffic, which means Windows-messages are just waiting in the queue, doing nothing.
If you don't want to burn your hands on multithreading, look into functions like select. That way you can create a loop having the following concept:

while( running )
{
// Listen for Windows messages and handle them
while( PeekMessage( ... ) )
{
case WM_BLABLA:
etc...
}

// See if there is network traffic and handle it
NetworkMessage mess;
while( NetworkTrafficMessage( &mess ) )
{
handleMessage( mess );
}
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!