LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-05-2004, 01:10 PM   #1
jhon
Member
 
Registered: Aug 2004
Posts: 32

Rep: Reputation: 15
TCP - max msg len


Hi all,

I have a small question:

my TCP application works fine when msg size is below 2047. but, when I tried to increase msg len to 20470 msgs didn't arrive properly. thus, when I printed the msgs arrived/ sent there was overflow.

my question is whether its explanation can be a too big msg size? if yes, what is the maximum msg len? and what do I do if I want to send longer msgs than maximum? if no, how else could it be explained? maybe, buffer_client_size != buffer_server_size? I checked it but it doesn't seem to be. any other explanation on your mind?

thanks guys
 
Old 09-05-2004, 02:59 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
In theory, the maximum size is ~64KB. But it's divided in pieces to match MTU (Maximum Transfer Unit). Then, you also have maximum window size. If you send longer messages, there may be problems. To see how it looks in your network, run tcpdump and check for 'win xxxxxx' when xxxxx is window size.
You can also have an OS that uses 'DF' (Don't fragment' bit in IP (most Linux machines do). It doesn't allow to divide the message, so it should be maximum of the size of MTU.
 
Old 09-06-2004, 01:39 AM   #3
jhon
Member
 
Registered: Aug 2004
Posts: 32

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Mara
>>In theory, the maximum size is ~64KB. But it's divided in pieces to match MTU (Maximum Transfer Unit).

Q1) what is the size of MTU? (I'm using LINUX (RH9))

>>Then, you also have maximum window size. If you send longer messages, there may be problems. To see how it looks in your network, run tcpdump and check for 'win xxxxxx' when xxxxx is window size.

>>You can also have an OS that uses 'DF' (Don't fragment' bit in IP (most Linux machines do). It doesn't allow to divide the message, so it should be maximum of the size of MTU.
Q2) how can I check if my OS uses DF or not?

Q3) does it make sense that sending an array whose size is 10240 bytes causes these problems or does it sounds to you like a memory leak problem.

please note that my exact problem that for (array[10240], array[0] = '1', array[1] = '\0') - well, after sending this array, I tried to print the received buffer and even though the first and second msgs were sent and received properly, the following printed msgs were something like '1 XXXXXX....XXXX'.

when I decreased array size to 1024, it workd fine.

again, I'm not aure if it's my fault (memory leak) or a networking problem.

thank you so much.
 
Old 09-09-2004, 07:49 AM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Q1) what is the size of MTU? (I'm using LINUX (RH9))
MTU depends on the medium used by the network you use. For example, for Ethernet it's 1500 B. You can always see the MTU used by one of your network interfaces by looking into ifconfig results. Example:
Code:
eth0      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
          inet addr:192.168.X.X  Bcast:192.168.X.X  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6348 errors:0 dropped:0 overruns:0 frame:0
It's eth0, so the MTU is 1500.
Q2) how can I check if my OS uses DF or not?
Use tcpdump to record traffic comming from your machine and check, but in Linux DF is used by default.

Q3) does it make sense that sending an array whose size is 10240 bytes causes these problems or does it sounds to you like a memory leak problem.
It depends how you send it. If you use raw sockets and create packet of that size, it's not a good idea. But if you use them more standard way, the array will be divided into a number of packets and then concatenated when received.

please note that my exact problem that for (array[10240], array[0] = '1', array[1] = '\0') - well, after sending this array, I tried to print the received buffer and even though the first and second msgs were sent and received properly, the following printed msgs were something like '1 XXXXXX....XXXX'.
Were the messages arrays or parts of the array? If the whole array was sent as one message, if received it should be complete. I'd check how it looks when sent, but I think it's rather a memory leak or something similar.
[/B][/QUOTE]
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what does this msg mean? jackandking Programming 5 12-18-2004 11:12 PM
Woody 3.0 Open Ports 1470/tcp/uaiact 1518/tcp/vpvd What for?How can I remove them? alexxxis Debian 5 07-05-2004 05:18 PM
Max Possible IDE items, Max IDE interfaces? KendersPlace Linux - Hardware 2 08-01-2003 06:58 PM
slooze error: validateInputs(); $msg = $mySlooze->renderPage($vars); echo $msg; ?> rioguia Linux - Software 0 01-26-2003 08:59 PM
close port 6000/tcp 515/tcp SchwipSchwap Linux - Newbie 1 09-12-2002 08:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration