Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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:
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]
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.