• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Building C language's binary protocol strings in Java

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

One of my fellow researchers (a C/C++ developer) was assigned to design a protocol and because he is a C programmer he designed something which is hard to implement in other languages which we need (VB, php, Java, C#).

If it had built something like SMTP and HTTP protocol (where even numbers are transferred in string format) it could be easily implemented. However he has used C structures.



1) Now the problem is that how can I create such commands (which contain binary coded numbers with different lengths) in Java?

2) What primitive data types I should use for 8bit and 32bit unsigned data types (in a way that later a C program does not have problem interpreting them as normal C data types)?

Thank you for your help.
Mac
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should have no problem writing and reading this with DataOutputStream/DataInputStream. The signed/unsigned issue won't be a problem if handled carefully.
reply
    Bookmark Topic Watch Topic
  • New Topic