Solved

Client/Server TCP packet troubles...

Posted on 2003-11-07
4
314 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Let’s list some of the technologies that enable smooth teleworking. 
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now