Solved

Client/Server TCP packet troubles...

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

#Citrix #Citrix Netscaler #HTTP Compression #Load Balance
Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

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