GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Jan-2007, 09:49
Mofix Mofix is offline
New Member
 
Join Date: Oct 2006
Posts: 12
Mofix is on a distinguished road

Linux Socket send() maximum size


Hi, I am having problem with socket function send();

Is there any limit how many characters can I send with send() function. On the client side I have QT 4.2.2 client with read method.

Is there a problem with server side socket send() function ? Any limit or something ?
Or client side ?
  #2  
Old 22-Jan-2007, 05:56
davis
 
Posts: n/a

Re: Linux Socket send() maximum size


Quote:
Originally Posted by Mofix
Is there any limit how many characters can I send with send() function.

You may send a maximum of the upper range of the largest number supported by a "size_t" (usually an unsigned int) on your system using a single send (2) call.

CPP / C++ / C Code:
ssize_t send(int s, const void *buf, size_t len, int flags);

Check the return value to see if it is sending the number of bytes that you expect.


:davis:
  #3  
Old 22-Jan-2007, 12:51
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,791
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Linux Socket send() maximum size


Quote:
Originally Posted by Mofix
H
Is there any limit how many characters can I send with send() function
When you say you are "having a problem", does that mean that we are supposed to guess at what the problem is? It's hard enough to guess the answer without having to guess at the problem too.

If by "having a problem" do you mean that send() returned -1? Or what?

If it returned -1, did you use perror() to try to print an error message? (If so, what did the message say? If not, then I suggest you give it a try.)



Since send() is not a standard C library function, details of its operation and limitations depend on the operating system and the compiler that you are using.

However, in general...

1. The send() function will fail if you try to send more octets than the maximum packet size of the underlying protocol.(For example, maximum UDP packet size is 65535 bytes, I think.)

2. Also, many (most???) implementations have a limited buffer size for data that may be smaller than this value. If the socket was opened in blocking mode, the socket will block. If the socket is in non blocking mode and you attempt to send more octets than the buffer size send() will fail.

In most cases, perror() should tell you what the error was.

If none of this helps, perhaps you could give us a few more details. (Like telling us the compiler and operating system. Like telling us the underlying protocol. Like describing any debugging steps that you have tried --- sending smaller packets, for example. Specifically: What worked? What didn't work?)

Regards,

Dave
Last edited by davekw7x : 22-Jan-2007 at 13:24.
  #4  
Old 26-Mar-2007, 12:38
asadujjaman asadujjaman is offline
New Member
 
Join Date: Mar 2007
Posts: 1
asadujjaman is on a distinguished road
Red face

Re: Linux Socket send() maximum size


I am using Windows XP SP2 and Visual Studio .NET 2005. So, what should be the maximum packet size that I can send()?
  #5  
Old 26-Mar-2007, 13:41
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,791
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Linux Socket send() maximum size


Quote:
Originally Posted by asadujjaman
I am using Windows XP SP2 and Visual Studio .NET 2005. So, what should be the maximum packet size that I can send()?

If you read my previous post, you may realize that the answer is, "It depends."

What, exactly, do you want to do?
What, exactly, have you tried?
What, exactly, happened?
What, exactly, is the problem?


Regards,

Dave
 
 

Recent GIDBlogStupid Management Policies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[PROGRAM] Winsock Programming Max Payne MS Visual C++ / MFC Forum 1 09-Mar-2007 00:38
Need Help With Recursive Functions jonas12rena C Programming Language 1 31-Jul-2006 12:12
sudoku C++, need lots of help :S 3shtar C++ Forum 3 06-Apr-2006 11:10
Having a problem Chuckles Computer Hardware Forum 19 13-Sep-2004 13:17

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:04.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.