Solved

Client/Server TCP packet troubles...

Posted on 2003-11-07
4
317 Views
Last Modified: 2013-12-07
I have two apps: the server with MFC sockets (CAsyncSocket) and a client with Win32 API sockets (NO MFC!)...
The problem:
1) When I send large amount of data, it arrives like several small packets. Is there a way to automatically merge this packets?
2) When I send several small packets in a short period of time, it arrives like ONE bigger packet. I need them to come in DIFFERENT packets - the way I send them.
0
Comment
Question by:WtG
  • 2
4 Comments
 

Author Comment

by:WtG
ID: 9700441
Solved by sending datasize along with the data in packet and merging/splitting manually upon arrival.
Maybe there IS an easier way to do this?

Another question:
Are Accept/Send/Recv functions fast enough to keep in server's main thread with multiple clients? With slow networks and client drops. Or should I create a sending thread for each client?

Thanx.
0
 
LVL 5

Expert Comment

by:vtobusman
ID: 9702017
 you can run all of those functions in the main thread assuming you have a pretty decent server...  the question would be how many clients and haw fast is the connection to the server ??
if you are on a local lan ( 100 mbps ) and have 300 users i would set them in different threads but if you have say 500 users and all connected thru the internet and you have say a T1 to the internet the memory ( RAM ) is more important and you can runn all in the same thread... it really depends on you setup...

  hope that sheds some light on you situation..

 and good luck
0
 
LVL 3

Accepted Solution

by:
guynumber5764 earned 250 total points
ID: 9703684
1) In general there is no easier way using TCP.  TCP just thinks of your data as a continuous stream which it can break up any way it wants--it is up to the application to interpret that stream (as you have done with your datasize).  It is worth noting that, once you are dealing with the Internet, your data may be arbitrarily merged or split several times along the way.

2) It doesn't matter too much which way you do it as long as you don't assume the requests/responses are coming in any specific sequence (ie: never block on an anticipated response).  Unless you are using SMPs, I would expect very little performance difference between the two approaches---it's mostly a matter of readability.
0
 

Author Comment

by:WtG
ID: 9703740
Thanx :]
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Dns issues 4 47
How to change the nameserver on Ubuntu Server 6 50
Vyos VLANs 14 36
Ping and real time 48 57
Don’t let your business fall victim to the coming apocalypse – use our Survival Guide for the Fax Apocalypse to identify the risks and signs of zombie fax activities at your business.
If you're not part of the solution, you're part of the problem.   Tips on how to secure IoT devices, even the dumbest ones, so they can't be used as part of a DDoS botnet.  Use PRTG Network Monitor as one of the building blocks, to detect unusual…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question