[ENet-discuss] What about a custom packet pattern?

Ross Linder info at tuxsoft.co.za
Thu Apr 14 05:54:33 PDT 2011


Yes I have been reading this thread and it does not make sense, Sergio it 
allmost sounds like you want to use Enet to send a customised UDP packet to a 
hardware device that is not running Enet.

If this is the case I think you are on the wrong approach, you should just use 
raw sockets.

If not then the format of the packet is not critical since you will encode and 
decode the data to be sent/received via Enet in your code. Changing Enet 
would still be the wrong approach IMO. Enet can be viewed as a transport 
system for your data.

Regards Ross
--

On Thursday 14 April 2011 14:15:07 Daniel Aquino wrote:
> What are you developing for?  Why does the device force you to follow this
> approach?
>
> I wonder if just like there is win32.c and unix.c you could simply
> implement your own backend which strips out the message part of the network
> packet and passes that to enet.. This way you don't have to modify enet at
> all..  Enet will build it's packet and send it to your custom backend where
> you can wrap it in your desired format.
>
> As long as your packets aren't very large and your sending frequently you
> shouldn't have to worry about fragmentation.
>
>
>
> On Thu, Apr 14, 2011 at 7:56 AM, Sergio Martin <
>
> smartin at freedomfactorystudios.com> wrote:
> > Hi,
> >
> >  What about all the other people that use enet?
> >
> >
> > These change are only intended for my project.
> > It's not like I'm going to commit to the enet CVS :D
> >
> >  Why don't you implement code to create packets and send them using enet.
> >
> >
> > I have already a message class for that. But I need to send UDP packets
> > in this very specific form over a custom network. Just to give you a
> > clue, I'm not developing for the PC ;-)
> >
> > El 14/04/2011 13:27, Jay Sprenkle escribió:
> >> Sergio,
> >> The pattern you've chosen sounds fine.
> >> I don't think changing enet to meet your requirements is a good idea
> >> though.
> >> What about all the other people that use enet?
> >> Why don't you implement code to create packets and send them using enet.
> >> That's how it's intended to be used.
> >> It works just fine for me.
> >>
> >>
> >>
> >>
> >>
> >>
> >> On Thu, Apr 14, 2011 at 5:40 AM, Sergio Martin
> >> <smartin at freedomfactorystudios.com
> >> <mailto:smartin at freedomfactorystudios.com>> wrote:
> >>
> >>    Hi,
> >>
> >>    In order to meet our client custom network requirement, I need to
> >>    send each UDP packet data as following:
> >>
> >>    [ size_of_game_data ] [ game_data ] [ voice_data ]
> >>
> >>
> >>    How difficult would be to modify ENet behaviour to meet that pattern?
> >>    I'm not sure how to deal with ENet's packet fragmentation.
> >>
> >>    I'm thinking of adding to ENetPacket struct two new variables:
> >>    enet_uint8 * voiceData;             /**< allocated voice data for
> >>    packet */
> >>    size_t           voiceDataLength;  /**< length of voice data */
> >>
> >>    Change: enet_packet_create (const void * data, size_t dataLength,
> >>    enet_uint32 flags)
> >>    To this: enet_packet_create(const void * data, size_t dataLength,
> >>    const void * voiceData, size_t voiceDataLength, enet_uint32 flags)
> >>
> >>    And then modify the rest of ENet to support it.
> >>
> >>
> >>    Is this the correct approach?
> >>
> >>
> >>    Best Regards,
> >>    Sergio Martin.
> >>
> >>    _______________________________________________
> >>    ENet-discuss mailing list
> >>    ENet-discuss at cubik.org <mailto:ENet-discuss at cubik.org>
> >>    http://lists.cubik.org/mailman/listinfo/enet-discuss
> >>
> >>
> >>
> >>
> >> --
> >> ---
> >> "The great thing about Object Oriented code is that it can make small,
> >> simple problems look like large, complex ones."
> >
> > _______________________________________________
> > ENet-discuss mailing list
> > ENet-discuss at cubik.org
> > http://lists.cubik.org/mailman/listinfo/enet-discuss




More information about the ENet-discuss mailing list