Byte Conversion Problems

T

Tim Wagaman

The project that I am working on currently, is a server application that
communicates across TCP IP. In this application, I recieve a request in
a TCP packet with a 4byte header. This 4 byte header is basically 3 null
bytes followed by the byte count in Hex.

I need to respond to the request using the same format. 3 null bytes and
the byte count in Hex followed by string data. The problem I have is the
response is always > 255 bytes. If it were <=255 bytes I could just
print the ascii character corresponding to the desired Hex value. But
since the reponse in usually > 900 bytes long, this does not work.

Anyone have any ideas?

Thanks
Tim Wagamn
 
J

Jay B. Harlow [MVP - Outlook]

Tim,
Are you certain that it is 3 null bytes and a byte count, and not a 4 byte
count?

A byte count only allows 255 character request.

If you want a 900 byte request you will need to use 2 bytes for the byte
count, which would then imply 2 null bytes...

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top