Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 17th, 2006, 1:06 AM   #1
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
Network flood?

I'm having a problem with my tcp server which seems to be having a problem receiving/sending data after the clients send a bunch of messages at once. Well actually, the messages can be pretty spread apart, but the server still seems to "lockup" until the user who was causing the mass packet, gets kicked or leaves the server. I know tcp is "special" for receiving everysingle packet, and wont move on until all packets have been received, but is there anyway I could speed the speed of the server so it doesn't take so long to receive, process data, then send to the clients again?

The server is used almost continuously and will most likely be flooded like this if I use it in a real situation if I put it out for people to use at the point it's at.

Perhaps a message queue would be the best situation in this case? Is there any nice solutions that I could be pointed towards, since I'm not exactly sure what I'm looking for at this point? Thanks in advanced.

I was just thinking, if I used separate sockets for sending and receiving data, would that reduce the "intensity" of this problem? currently, I have one socket(sockfd) to send data and receive data.
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote
Old Apr 17th, 2006, 4:00 AM   #2
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5 grumpy will become famous soon enough
Another question with nothing to do with C++.

An obvious, if simplistic, approach would be to launch a separate thread (or process) for each connection. That way, only a particular thread will lock up rather than the whole server. You can also enforce some type of timeout policy (eg if a particular thread appears to have locked up, terminate it, but keep in mind that terminating threads does not release all resources used by the thread on some systems). Each thread could also impose some form of policy to slow down response to a user (eg if two packets arrive close together from the same, wait a specified period before responding to the second one).

Without more specifics on what you're doing, it's difficult to give more useful advice.
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:34 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC