Jump to content

Encoding Used by BankStream


gothboiclique
 Share

Go to solution Solved by Josh,

Recommended Posts

Hi again. Messing around with the built in networking (ENet), I wrote a C# app for testing with an ENet Library wrapper. I'm able to connect and send messages but I'm not quite sure how to parse a bank stream on my server's end. Any ideas from C#?

For example if I send a string "this is a test" using Client:Send in Leadwerks, my server will see "? This is a test" the question mark being a wrongly parsed symbol which I assume is the message ID from Leadwerks. 

var dataString = Encoding.ASCII.GetString(Event.Packet.Data);

 

Link to comment
Share on other sites

int i = 0;

byte[] bytes = new byte[4];

foreach (var element in Event.Packet.Data)
{
  if (i < 4)
  {
    bytes[i] = element;
  }

  i++;
}

int eventId = BitConverter.ToInt32(bytes, 0);

Really quick example that I'm going to turn into a BankStream class for C# but I'm able to get the Event ID and next int. Floats seem to use a different size and for strings, I'm not sure what the separation you use is.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...