I'm using length based message framing with python twisted framework with a C# client running BeginRecieve async reads and I'm having trouble grabbing the value of the length of the message.
This is the twisted python code

self.transport.write(pack(self.structFormat, len(string)) + string)

And this is the C# code:

int bytesRead = client.EndReceive(ar);
if (bytesRead > 0)
  {
   int msg_size = BitConverter.ToInt32(state.buffer, 0);

Problem is the len(string) value is not correct when I grab it via Bitconverter on the c# side.
The value should be 15 but its coming across as 251658240.
Any insight would be much appreciated.
Sorry the question was badly asked. I did find the solution though.

int netmsg_size = BitConverter.ToInt32(state.buffer, 0);
int msg_size = IPAddress.NetworkToHostOrder(netmsg_size);

This converts the network integer back into a regular integer.
Python Twisted frameowrk transport.write to a c# socket BeginReceive reading length based message framing value