Re: [gnet] Multicasting - UDP



Nelio,

Use recv() or recvfrom().  It will tell you the buffer length, so you
don't need the \0.

The buffer should be large enough to fit the largest possible packet for
your application.  Typically you want to keed it under ~1500 bytes,
since that's the maximum packet size for ethernet.  If it's above that,
the packet will be fragmented, which increases the chance the whole
packet will be dropped.

David


On Fri, 2003-05-30 at 22:30, Nelio Pereira wrote:
> I want to send a piece of information over multicast,
> and this information doesn't have a pre-determined
> size. That is, its length will vary according to the
> the moment. To determine that the buffer is over, I'm
> attaching a '\0' at its end. My question: how can I
> receive this kind of information over UDP sockets? If
> I have a receiver buffer large enough to accomodate my
> message, everything is fine; if my receiver buffer is
> smaller than the information being sent, I cannot make
> two consective reads on the UDP socket to get the rest
> of the message.
> 
> Does anyone can help me with this issue?



-- 
David Helder - dhelder gizmolabs org - http://www.gizmolabs.org/~dhelder




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]