If it's a custom protocol then just use Enet the way it's meant to be used.<br><br>There is no reason you can't send voice through Enet.<br><br>Does xbox/ps not provide some kind of api for you to feed it the audio data ?  Or are you saying that the console basically sniffs the data as it passes by and it must be in that format ?  <br>
<br>Also note that Enet ignores any data that it doesn't recognize potentially you could just let the console use the same udp port and the invalid Enet message will be dropped.<br><br><br><br><div class="gmail_quote">
On Thu, Apr 14, 2011 at 10:48 AM, Sergio Martin <span dir="ltr"><<a href="mailto:smartin@freedomfactorystudios.com">smartin@freedomfactorystudios.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
It's not a problem of serialization, I need to customize the way packet data is sent by enet. It's a requirement of this custom UDP protocol.<br>
<br>
Of course the [game data] part of the packet will use serialization (also encryption, compression, etc).<br>
<br>
I hope this will clarify the matter.<br>
<br>
<br>
El 14/04/2011 16:19, Jay Sprenkle escribió:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I did the same thing (but for the pc).<br>
I answered a question about how I did the serialization here<br>
<<a href="http://stackoverflow.com/questions/5623791/c-network-serialization/5624996#5624996" target="_blank">http://stackoverflow.com/questions/5623791/c-network-serialization/5624996#5624996</a>><br>
<<a href="http://stackoverflow.com/questions/5623791/c-network-serialization/5624996#5624996" target="_blank">http://stackoverflow.com/questions/5623791/c-network-serialization/5624996#5624996</a>>I<br>
use Separation of concerns<br>
<<a href="http://en.wikipedia.org/wiki/Separation_of_concerns" target="_blank">http://en.wikipedia.org/wiki/Separation_of_concerns</a>> for my designs so<br>
I never looked a serialization as being part of enet<br>
<br>
On Thu, Apr 14, 2011 at 6:35 AM, Sergio Martin<div class="im"><br>
<<a href="mailto:smartin@freedomfactorystudios.com" target="_blank">smartin@freedomfactorystudios.com</a><br>
<mailto:<a href="mailto:smartin@freedomfactorystudios.com" target="_blank">smartin@freedomfactorystudios.com</a>>> wrote:<br>
<br>
     > What about all the other people that use enet?<br>
<br>
    These change are only intended for my project.<br>
    It's not like I'm going to commit to the enet CVS :D<br>
<br>
     > Why don't you implement code to create packets and send them<br>
    using enet.<br>
<br>
    I have already a message class for that. But I need to send UDP<br>
    packets in this very specific form over a custom network. Just to<br>
    give you a clue, I'm not developing for the PC ;-)<br>
<br>
<br>
    El 14/04/2011 13:27, Jay Sprenkle escribió:<br>
<br>
        Sergio,<br>
        The pattern you've chosen sounds fine.<br>
        I don't think changing enet to meet your requirements is a good<br>
        idea though.<br>
        What about all the other people that use enet?<br>
        Why don't you implement code to create packets and send them<br>
        using enet.<br>
        That's how it's intended to be used.<br>
        It works just fine for me.<br>
<br>
<br>
<br>
<br>
<br>
        On Thu, Apr 14, 2011 at 5:40 AM, Sergio Martin<br>
        <<a href="mailto:smartin@freedomfactorystudios.com" target="_blank">smartin@freedomfactorystudios.com</a><br>
        <mailto:<a href="mailto:smartin@freedomfactorystudios.com" target="_blank">smartin@freedomfactorystudios.com</a>><br></div>
        <mailto:<a href="mailto:smartin@freedomfactorystudios.com" target="_blank">smartin@freedomfactorystudios.com</a><div class="im"><br>
        <mailto:<a href="mailto:smartin@freedomfactorystudios.com" target="_blank">smartin@freedomfactorystudios.com</a>>>> wrote:<br>
<br></div><div><div></div><div class="h5">
            Hi,<br>
<br>
            In order to meet our client custom network requirement, I<br>
        need to<br>
            send each UDP packet data as following:<br>
<br>
            [ size_of_game_data ] [ game_data ] [ voice_data ]<br>
<br>
<br>
            How difficult would be to modify ENet behaviour to meet that<br>
        pattern?<br>
            I'm not sure how to deal with ENet's packet fragmentation.<br>
<br>
            I'm thinking of adding to ENetPacket struct two new variables:<br>
            enet_uint8 * voiceData;             /**< allocated voice<br>
        data for<br>
            packet */<br>
            size_t           voiceDataLength;  /**< length of voice data */<br>
<br>
            Change: enet_packet_create (const void * data, size_t<br>
        dataLength,<br>
            enet_uint32 flags)<br>
            To this: enet_packet_create(const void * data, size_t<br>
        dataLength,<br>
            const void * voiceData, size_t voiceDataLength, enet_uint32<br>
        flags)<br>
<br>
            And then modify the rest of ENet to support it.<br>
<br>
<br>
            Is this the correct approach?<br>
<br>
<br>
            Best Regards,<br>
            Sergio Martin.<br>
<br>
            _______________________________________________<br>
            ENet-discuss mailing list<br></div></div>
        <a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a> <mailto:<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a>><br>
        <mailto:<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a> <mailto:<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a>>><div class="im"><br>

        <a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
<br>
<br>
<br>
<br></div><div class="im">
        --<br>
        ---<br>
        "The great thing about Object Oriented code is that it can make<br>
        small,<br>
        simple problems look like large, complex ones."<br>
<br>
<br>
<br>
<br>
--<br>
---<br>
"The great thing about Object Oriented code is that it can make small,<br>
simple problems look like large, complex ones."<br>
</div></blockquote>
_______________________________________________<div><div></div><div class="h5"><br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
</div></div></blockquote></div><br>