Skip to main content
9 events
when toggle format what by license comment
Oct 14, 2019 at 20:28 vote accept M0r13n
Oct 14, 2019 at 20:28 comment added M0r13n Thats definitly right, but my primary concern is to learn something about working with binary data. Otherwise I would use a c++-based library such as libais. Thanks for your great support!
Oct 14, 2019 at 19:20 comment added Reinderien I think so :) That being said, I think your concern for performance is a little unbalanced. I ran the code against your default server and the rate of message reception is very low. You should be optimizing for correctness and simplicity first.
Oct 14, 2019 at 19:18 comment added M0r13n I see. Now that we are working with raw bytes, values can be extracted by bitwise operations like so: raw_bytes[0] & 0x3f to get the first 6 bits. That should be pretty fast, doesnt it?
Oct 14, 2019 at 13:27 comment added Reinderien The problem is not that a message may be longer than 4096 bytes - the problem is that one message may be split across the buffer boundary if many messages are received at once. You're using TCP, so there is no guarantee of predictable packet size.
Oct 14, 2019 at 8:07 comment added M0r13n Thank you for you comments and improvements. I am already thinking and trying around to avoid stringly-typed data. I hope that I can get it to work soon. I don't think that there are two generators needed, because the AIS spec does not allow for a message to be longer than 4096 bytes. At least I did not find any exception. The modularization is definitely nice and will help other to gain a quicker overview!
Oct 13, 2019 at 21:53 history edited Reinderien CC BY-SA 4.0
added 349 characters in body
Oct 13, 2019 at 17:15 history edited Reinderien CC BY-SA 4.0
deleted 594 characters in body
Oct 13, 2019 at 16:34 history answered Reinderien CC BY-SA 4.0