The title is my question ???
The title is my question ???
There is no maximum number of bytes that can be sent through a socket. Bytes are put together into "packets", and transmitted (usually), as such, according to the format that's being used.Originally Posted by tritong
If you want to know the size and spec's of the TCP/IP protocol/format, generally used on the internet, you'll need to either google it, or go to an internet communication forum or newsgroup.
It's not a part of the C language.
Good luck.
Adak
> maximum data (bytes) send via socket ?
You mean in a single call to send() ?
You can send as many as you like, but you must look at the return result to find out how many were actually sent. Then call send() again with the remainder of the buffer until all of your data is sent (or until send returns an error)
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
While TCP stream does not preserve boundary, UDP does, so 1 UDP send() == 1 UDP receive(), and afaik (and I can be wrong) a single UDP message (send()) may be no more 65k in size....
Last edited by _jr; 09-18-2006 at 08:19 AM.
maximum can use (strlen(str)) = ?Code:int rc = write(socket, str, strlen(str));
Does it greater than 4096 ???
What have you tried already?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
strlen() returns a value of type size_t. The maximum value that can be stored in a size_t is implementation dependent (i.e. depends on your compiler and target machine). Read the documentation for your compiler, and you will be able to find what that maximum is.