?
Solved

Client/Server TCP packet troubles...

Posted on 2003-11-07
4
Medium Priority
?
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

During and after that shift to cloud, one area that still poses a struggle for many organizations is what to do with their department file shares.
In this article, we’ll look at how to deploy ProxySQL.
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

777 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