View Full Version : how to send a packet ,its size over 65536!!
Aben821
05-16-2003, 07:09 AM
now ,i am making a multicast programming,its function is to multicast the video&&audio to a group,but its size is 66302,based on UDP.and i have set the socket buffer useing setsockopt();its size is 128*1024,but now the server still can't send the packet out.then the client can't receive it,so the client can't play continously!what maybe are the reasons???
thanks for lots!!,
shiva
05-16-2003, 09:31 AM
Send the datas block by block say 1024 size. Make the client to receive till your end flag.
otherwise,
Make the protocol between client and server, like first send the number of blocks to be read, and then client shall read the total number of blocks.
client implementation
noOfBlocks = retrived from the server;
int ii=0;
for(; ii<noOfBlocks; ii++)
{
blocks = read(fd,buffer,1024);
//append the buffer to yr master buffer
// or where ever you want
}
This shall solve yr problem.
shiva
Aben821
05-16-2003, 11:00 AM
thanks,shilva!i will try ur methods,now i have tested the errno :EMSGSIZE,i think that because the packetsize(66053) over 65536,but i have set the socket buffer size using setsockopt,and then i use getsockopt ,find it works,but why can i still not send the packet out,setsockopt(sockfd,SOL_SOCKET,SO_SNDBUF,&n,size of(n));;if it works,it will be more easy!
RobSeace
05-16-2003, 01:20 PM
It's not your send buffer that's the problem, so increasing it
won't help at all... It's the fact that a single datagram can't
exceed 64K bytes... It's just a hard limit built into UDP... The
total message length in the UDP header is an unsigned 16-bit
short int... So, you can never send a single UDP datagram
larger than 64K in size...
mlampkin
05-16-2003, 11:28 PM
The following a direct link to the RFC that covers UDP (RFC 768)...
http://www.faqs.org/rfcs/rfc768.html
As you can see from the first page or so (and as Rob already pointed out) the packet length field is limited to a 16 bit value...
...and why did I post this? Cause well... it couldn't hurt to point you to the RFC... and besides...
I AM LOSING IN THE MSG POSTING COUNT TO ROB AND LOCO!!!
Lol... ;-)
Michael
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.