Please login or register.

Login with username, password and session length

News:

Registration is only required if you want to post, and is not needed to read any posts. To avoid excess 'spam' accounts, all accounts where no posts have been made will be deleted after two weeks. Please register again if you wish to post.

Author Topic: Changes in Networking (current version of Bridgecommand)  (Read 6915 times)

September 19, 2018, 01:15:14 PM
  • Member
  • **
  • Posts: 1
    • View Profile
Firstly this is a thoroughly impressive (and comprehensive) simulator. I was playing around with its interface and hoping to make my own controller for it, when I noticed a forum member named Huckleberry had tried something similar and seemingly got it working really easily.

I opened up a listening port in Python (UDP on port 18304) and started the newest BC (ver 5.3 as of this writing) looking for the message described in the networking page. What I receive on there is fairly indecipherable, however it does look consistent between restarts of BC.

For instance - here is one such received string

b'\x8f\xff\x13\xe4\x82\xff\x00\x01\x00\x00\xff\xff\x00\x00\x05x\x00\x00\x10\x00\x00\x00\x00\x02\x00\x00\x1c \x00\x00\x07\x08\x00\x00\x13\x88\x00\x00\x00\x02\x00\x00\x00\x02\x9f4R\xd3\x00\x00\x00\x00'

I assumed it was some encoding/decoding error on my end - but I cant seem to find a codec which would change any of those byte to BC.

I tried running netcat on the same port and got essentially the same string (without seeing the hex representations of course)

I then downloaded an older version (4.6) and the strings immediately looked like what I expected from the documentation.
(ú  BC1289041152,0.0,1289041152#1369.59,4314.28,180.0,0.0,etc...) - essentially integer followed by the BC string.

Is there another encoding or perhaps something I've overlooked in the new version to get the right string there ?

Thanks very much for developing such an amazing piece of software and for all your help !

September 20, 2018, 03:46:34 PM
Reply #1
  • Administrator
  • Member
  • *****
  • Posts: 146
    • View Profile
Hello, in the 5.x versions I'm using the ENet networking library (http://enet.bespin.org/) which has its own lightweight layer on top of UDP, so that is probably why the raw UDP data is looking mangled.

I see that there's a python wrapper for ENet (https://pypi.org/project/pyenet), so this may be useful> Their git repository includes an example of usage: https://github.com/piqueserver/pyenet/blob/master/test_client.py