Boost ASIO - dropped UDP packets, significant loss compared to UE4 udp reciever












0















I am trying to use a simple async UDP listener using this. I also use UE4 UDP Socket (FUdpSocketBuilder) in a game engine project. I don't run these two UDP listeners simultaneously. I get a series of byte array from a fixed udp port from another application in following order start 36, middle 65488 x 6 and end 400 bytes. But the problem is I miss 4 x 65488 bytes and sometimes I get the trailing 400 bytes in the boost asio example C++ app. I have tried increasing the received byte array size to a high number including 7-8 times what is declared below:



 constexpr int udp_buffer_size = 65536;  // Max limit of each packet size
boost::array<char, udp_buffer_size> recv_buffer_;


What can I do, please advice ? I have also asked this question on Github.



Print from Boost ASIO UDP:



I just recieved 36 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 36 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 65488 bytes of data !


Print from UE4:



[2018.11.28 - 17.18.29:724][829]SomeProjectLog:  Warning : 2297. Recieved Bytes from UDP 36.
[2018.11.28 - 17.18.29:724][829]SomeProjectLog : Warning : 2298. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:724][829]SomeProjectLog : Warning : 2299. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2300. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2301. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2302. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2303. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2304. Recieved Bytes from UDP 400.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2305. Recieved Bytes from UDP 36.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2306. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2307. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2308. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2309. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2310. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2311. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2312. Recieved Bytes from UDP 400.









share|improve this question

























  • A UDP packet of 65488 bytes? While technically possible, why would you do this?

    – SergeyA
    Nov 28 '18 at 19:03











  • It is coming from another app, that I don't have control, I am just reading from a fixed port. But I would like to get educated as to why 65k bytes is bad idea ?

    – Syed Alam Abbas
    Nov 28 '18 at 19:04











  • Because UDP has no guaranteed delivery. Any packet which exceeds MTU size (likely 1500 bytes) is going to be broken up into several low-level datagrams to be assembled on the receiving side. If the receiving side misses at least one of those packets, the whole sequence is dropped. In your case, you end up with 44 packets.

    – SergeyA
    Nov 28 '18 at 19:09











  • Point taken, but I dont have any control of what is being sent, it is external data source app, but in any case there are two things that should be looked at, there is really no true network communication happening, since the external app is hosted and sending on local machine. Second is that UE4 udp reciever get all the bytes exactly so why shouldn't ASIO UDP !

    – Syed Alam Abbas
    Nov 28 '18 at 19:13











  • I didn't get the fact that it is on the local machine. Than the most likely reason is performance. Your ASIO server is to slow processing data, so packets are dropped.

    – SergeyA
    Nov 28 '18 at 19:19
















0















I am trying to use a simple async UDP listener using this. I also use UE4 UDP Socket (FUdpSocketBuilder) in a game engine project. I don't run these two UDP listeners simultaneously. I get a series of byte array from a fixed udp port from another application in following order start 36, middle 65488 x 6 and end 400 bytes. But the problem is I miss 4 x 65488 bytes and sometimes I get the trailing 400 bytes in the boost asio example C++ app. I have tried increasing the received byte array size to a high number including 7-8 times what is declared below:



 constexpr int udp_buffer_size = 65536;  // Max limit of each packet size
boost::array<char, udp_buffer_size> recv_buffer_;


What can I do, please advice ? I have also asked this question on Github.



Print from Boost ASIO UDP:



I just recieved 36 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 36 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 65488 bytes of data !


Print from UE4:



[2018.11.28 - 17.18.29:724][829]SomeProjectLog:  Warning : 2297. Recieved Bytes from UDP 36.
[2018.11.28 - 17.18.29:724][829]SomeProjectLog : Warning : 2298. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:724][829]SomeProjectLog : Warning : 2299. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2300. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2301. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2302. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2303. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2304. Recieved Bytes from UDP 400.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2305. Recieved Bytes from UDP 36.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2306. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2307. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2308. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2309. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2310. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2311. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2312. Recieved Bytes from UDP 400.









share|improve this question

























  • A UDP packet of 65488 bytes? While technically possible, why would you do this?

    – SergeyA
    Nov 28 '18 at 19:03











  • It is coming from another app, that I don't have control, I am just reading from a fixed port. But I would like to get educated as to why 65k bytes is bad idea ?

    – Syed Alam Abbas
    Nov 28 '18 at 19:04











  • Because UDP has no guaranteed delivery. Any packet which exceeds MTU size (likely 1500 bytes) is going to be broken up into several low-level datagrams to be assembled on the receiving side. If the receiving side misses at least one of those packets, the whole sequence is dropped. In your case, you end up with 44 packets.

    – SergeyA
    Nov 28 '18 at 19:09











  • Point taken, but I dont have any control of what is being sent, it is external data source app, but in any case there are two things that should be looked at, there is really no true network communication happening, since the external app is hosted and sending on local machine. Second is that UE4 udp reciever get all the bytes exactly so why shouldn't ASIO UDP !

    – Syed Alam Abbas
    Nov 28 '18 at 19:13











  • I didn't get the fact that it is on the local machine. Than the most likely reason is performance. Your ASIO server is to slow processing data, so packets are dropped.

    – SergeyA
    Nov 28 '18 at 19:19














0












0








0








I am trying to use a simple async UDP listener using this. I also use UE4 UDP Socket (FUdpSocketBuilder) in a game engine project. I don't run these two UDP listeners simultaneously. I get a series of byte array from a fixed udp port from another application in following order start 36, middle 65488 x 6 and end 400 bytes. But the problem is I miss 4 x 65488 bytes and sometimes I get the trailing 400 bytes in the boost asio example C++ app. I have tried increasing the received byte array size to a high number including 7-8 times what is declared below:



 constexpr int udp_buffer_size = 65536;  // Max limit of each packet size
boost::array<char, udp_buffer_size> recv_buffer_;


What can I do, please advice ? I have also asked this question on Github.



Print from Boost ASIO UDP:



I just recieved 36 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 36 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 65488 bytes of data !


Print from UE4:



[2018.11.28 - 17.18.29:724][829]SomeProjectLog:  Warning : 2297. Recieved Bytes from UDP 36.
[2018.11.28 - 17.18.29:724][829]SomeProjectLog : Warning : 2298. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:724][829]SomeProjectLog : Warning : 2299. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2300. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2301. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2302. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2303. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2304. Recieved Bytes from UDP 400.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2305. Recieved Bytes from UDP 36.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2306. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2307. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2308. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2309. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2310. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2311. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2312. Recieved Bytes from UDP 400.









share|improve this question
















I am trying to use a simple async UDP listener using this. I also use UE4 UDP Socket (FUdpSocketBuilder) in a game engine project. I don't run these two UDP listeners simultaneously. I get a series of byte array from a fixed udp port from another application in following order start 36, middle 65488 x 6 and end 400 bytes. But the problem is I miss 4 x 65488 bytes and sometimes I get the trailing 400 bytes in the boost asio example C++ app. I have tried increasing the received byte array size to a high number including 7-8 times what is declared below:



 constexpr int udp_buffer_size = 65536;  // Max limit of each packet size
boost::array<char, udp_buffer_size> recv_buffer_;


What can I do, please advice ? I have also asked this question on Github.



Print from Boost ASIO UDP:



I just recieved 36 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 36 bytes of data !
I just recieved 65488 bytes of data !
I just recieved 65488 bytes of data !


Print from UE4:



[2018.11.28 - 17.18.29:724][829]SomeProjectLog:  Warning : 2297. Recieved Bytes from UDP 36.
[2018.11.28 - 17.18.29:724][829]SomeProjectLog : Warning : 2298. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:724][829]SomeProjectLog : Warning : 2299. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2300. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2301. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2302. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:725][829]SomeProjectLog : Warning : 2303. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2304. Recieved Bytes from UDP 400.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2305. Recieved Bytes from UDP 36.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2306. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2307. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:726][829]SomeProjectLog : Warning : 2308. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2309. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2310. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2311. Recieved Bytes from UDP 65488.
[2018.11.28 - 17.18.29:727][829]SomeProjectLog : Warning : 2312. Recieved Bytes from UDP 400.






c++ boost udp packet-loss






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 '18 at 20:01







Syed Alam Abbas

















asked Nov 28 '18 at 19:01









Syed Alam AbbasSyed Alam Abbas

262316




262316













  • A UDP packet of 65488 bytes? While technically possible, why would you do this?

    – SergeyA
    Nov 28 '18 at 19:03











  • It is coming from another app, that I don't have control, I am just reading from a fixed port. But I would like to get educated as to why 65k bytes is bad idea ?

    – Syed Alam Abbas
    Nov 28 '18 at 19:04











  • Because UDP has no guaranteed delivery. Any packet which exceeds MTU size (likely 1500 bytes) is going to be broken up into several low-level datagrams to be assembled on the receiving side. If the receiving side misses at least one of those packets, the whole sequence is dropped. In your case, you end up with 44 packets.

    – SergeyA
    Nov 28 '18 at 19:09











  • Point taken, but I dont have any control of what is being sent, it is external data source app, but in any case there are two things that should be looked at, there is really no true network communication happening, since the external app is hosted and sending on local machine. Second is that UE4 udp reciever get all the bytes exactly so why shouldn't ASIO UDP !

    – Syed Alam Abbas
    Nov 28 '18 at 19:13











  • I didn't get the fact that it is on the local machine. Than the most likely reason is performance. Your ASIO server is to slow processing data, so packets are dropped.

    – SergeyA
    Nov 28 '18 at 19:19



















  • A UDP packet of 65488 bytes? While technically possible, why would you do this?

    – SergeyA
    Nov 28 '18 at 19:03











  • It is coming from another app, that I don't have control, I am just reading from a fixed port. But I would like to get educated as to why 65k bytes is bad idea ?

    – Syed Alam Abbas
    Nov 28 '18 at 19:04











  • Because UDP has no guaranteed delivery. Any packet which exceeds MTU size (likely 1500 bytes) is going to be broken up into several low-level datagrams to be assembled on the receiving side. If the receiving side misses at least one of those packets, the whole sequence is dropped. In your case, you end up with 44 packets.

    – SergeyA
    Nov 28 '18 at 19:09











  • Point taken, but I dont have any control of what is being sent, it is external data source app, but in any case there are two things that should be looked at, there is really no true network communication happening, since the external app is hosted and sending on local machine. Second is that UE4 udp reciever get all the bytes exactly so why shouldn't ASIO UDP !

    – Syed Alam Abbas
    Nov 28 '18 at 19:13











  • I didn't get the fact that it is on the local machine. Than the most likely reason is performance. Your ASIO server is to slow processing data, so packets are dropped.

    – SergeyA
    Nov 28 '18 at 19:19

















A UDP packet of 65488 bytes? While technically possible, why would you do this?

– SergeyA
Nov 28 '18 at 19:03





A UDP packet of 65488 bytes? While technically possible, why would you do this?

– SergeyA
Nov 28 '18 at 19:03













It is coming from another app, that I don't have control, I am just reading from a fixed port. But I would like to get educated as to why 65k bytes is bad idea ?

– Syed Alam Abbas
Nov 28 '18 at 19:04





It is coming from another app, that I don't have control, I am just reading from a fixed port. But I would like to get educated as to why 65k bytes is bad idea ?

– Syed Alam Abbas
Nov 28 '18 at 19:04













Because UDP has no guaranteed delivery. Any packet which exceeds MTU size (likely 1500 bytes) is going to be broken up into several low-level datagrams to be assembled on the receiving side. If the receiving side misses at least one of those packets, the whole sequence is dropped. In your case, you end up with 44 packets.

– SergeyA
Nov 28 '18 at 19:09





Because UDP has no guaranteed delivery. Any packet which exceeds MTU size (likely 1500 bytes) is going to be broken up into several low-level datagrams to be assembled on the receiving side. If the receiving side misses at least one of those packets, the whole sequence is dropped. In your case, you end up with 44 packets.

– SergeyA
Nov 28 '18 at 19:09













Point taken, but I dont have any control of what is being sent, it is external data source app, but in any case there are two things that should be looked at, there is really no true network communication happening, since the external app is hosted and sending on local machine. Second is that UE4 udp reciever get all the bytes exactly so why shouldn't ASIO UDP !

– Syed Alam Abbas
Nov 28 '18 at 19:13





Point taken, but I dont have any control of what is being sent, it is external data source app, but in any case there are two things that should be looked at, there is really no true network communication happening, since the external app is hosted and sending on local machine. Second is that UE4 udp reciever get all the bytes exactly so why shouldn't ASIO UDP !

– Syed Alam Abbas
Nov 28 '18 at 19:13













I didn't get the fact that it is on the local machine. Than the most likely reason is performance. Your ASIO server is to slow processing data, so packets are dropped.

– SergeyA
Nov 28 '18 at 19:19





I didn't get the fact that it is on the local machine. Than the most likely reason is performance. Your ASIO server is to slow processing data, so packets are dropped.

– SergeyA
Nov 28 '18 at 19:19












1 Answer
1






active

oldest

votes


















0














I was able to fix the UDP packets loss issue today. It is not a concurrency issue that can be solved by using a separate thread. It is the issue of data speed intra-epoch not inter-epoch. What I mean by that is, it is a data stream that dumps UDP packets on the port epoch(significant event) to epoch with some acquisition delay in between. That is the window of opportunity to process anything, not within the epoch, but just after the epoch which is the 400 trailing bytes. I am using a single threaded program but I have Boost ASIO i/o object for asynchronous operations. All I do now is a fast memory copy of every byte array received until I hit a modulo - N(epoch bytes total), then I process each packet from the accumulated array, then I am able to collect all the data without any packet loss! Thanks for all the help @SergeyA

If you want to read more about why it is not advisable to use threads besides making application complicated here is the link : The Proactor Design Pattern: Concurrency Without Threads.






share|improve this answer


























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53526361%2fboost-asio-dropped-udp-packets-significant-loss-compared-to-ue4-udp-reciever%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I was able to fix the UDP packets loss issue today. It is not a concurrency issue that can be solved by using a separate thread. It is the issue of data speed intra-epoch not inter-epoch. What I mean by that is, it is a data stream that dumps UDP packets on the port epoch(significant event) to epoch with some acquisition delay in between. That is the window of opportunity to process anything, not within the epoch, but just after the epoch which is the 400 trailing bytes. I am using a single threaded program but I have Boost ASIO i/o object for asynchronous operations. All I do now is a fast memory copy of every byte array received until I hit a modulo - N(epoch bytes total), then I process each packet from the accumulated array, then I am able to collect all the data without any packet loss! Thanks for all the help @SergeyA

    If you want to read more about why it is not advisable to use threads besides making application complicated here is the link : The Proactor Design Pattern: Concurrency Without Threads.






    share|improve this answer






























      0














      I was able to fix the UDP packets loss issue today. It is not a concurrency issue that can be solved by using a separate thread. It is the issue of data speed intra-epoch not inter-epoch. What I mean by that is, it is a data stream that dumps UDP packets on the port epoch(significant event) to epoch with some acquisition delay in between. That is the window of opportunity to process anything, not within the epoch, but just after the epoch which is the 400 trailing bytes. I am using a single threaded program but I have Boost ASIO i/o object for asynchronous operations. All I do now is a fast memory copy of every byte array received until I hit a modulo - N(epoch bytes total), then I process each packet from the accumulated array, then I am able to collect all the data without any packet loss! Thanks for all the help @SergeyA

      If you want to read more about why it is not advisable to use threads besides making application complicated here is the link : The Proactor Design Pattern: Concurrency Without Threads.






      share|improve this answer




























        0












        0








        0







        I was able to fix the UDP packets loss issue today. It is not a concurrency issue that can be solved by using a separate thread. It is the issue of data speed intra-epoch not inter-epoch. What I mean by that is, it is a data stream that dumps UDP packets on the port epoch(significant event) to epoch with some acquisition delay in between. That is the window of opportunity to process anything, not within the epoch, but just after the epoch which is the 400 trailing bytes. I am using a single threaded program but I have Boost ASIO i/o object for asynchronous operations. All I do now is a fast memory copy of every byte array received until I hit a modulo - N(epoch bytes total), then I process each packet from the accumulated array, then I am able to collect all the data without any packet loss! Thanks for all the help @SergeyA

        If you want to read more about why it is not advisable to use threads besides making application complicated here is the link : The Proactor Design Pattern: Concurrency Without Threads.






        share|improve this answer















        I was able to fix the UDP packets loss issue today. It is not a concurrency issue that can be solved by using a separate thread. It is the issue of data speed intra-epoch not inter-epoch. What I mean by that is, it is a data stream that dumps UDP packets on the port epoch(significant event) to epoch with some acquisition delay in between. That is the window of opportunity to process anything, not within the epoch, but just after the epoch which is the 400 trailing bytes. I am using a single threaded program but I have Boost ASIO i/o object for asynchronous operations. All I do now is a fast memory copy of every byte array received until I hit a modulo - N(epoch bytes total), then I process each packet from the accumulated array, then I am able to collect all the data without any packet loss! Thanks for all the help @SergeyA

        If you want to read more about why it is not advisable to use threads besides making application complicated here is the link : The Proactor Design Pattern: Concurrency Without Threads.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        answered Nov 30 '18 at 2:46


























        community wiki





        Syed Alam Abbas

































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53526361%2fboost-asio-dropped-udp-packets-significant-loss-compared-to-ue4-udp-reciever%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)