login about faq

Issue being is that characters are being lost in the higher ranges, and UTF-8 is not a possibility on the receiving end. They currenlty transmit RAW binary data with no character set correlation. I see no way of doing this on socket side using SendString, ReceiveString, SendBytes, ReceiveBytes. Even though the later SendBytes and ReceiveBytes say that Character Sets are not used it seems to default to a Unicode setting by default... meaning it just can not be changed from that setting unlike the SendString and ReceiveString... So back to the deal, need to send information in binary form as handed to the Chilkat without any chracter manipulation.

asked Sep 10 '12 at 16:12

mike's gravatar image

mike
1111


Mike,

SendBytes and ReceiveBytes do not treat the data as characters. The exact binary bytes provided by the app are sent (for SendBytes) and the exact bytes received by ReceiveBytes are returned, with no manipulation.

link

answered Sep 10 '12 at 17:15

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

I don't know if CkSocket has any methods for this.... maybe this is a case of (I believe it is called) network byte order. Perhaps the high-order bytes and low-order bytes have "flipped"?

http://en.wikipedia.org/wiki/Endianness

I am sure Matt knows what I am talking about ;-)

PS. Windows to Windows should not be a problem (or better Intel to Intel) as they use the same byte order. If this is between different OS's (or actually hardware architecture), that would be what I look for. The sending (likely) or receiving party is not properly converting to/from network byte order.

This article explains it quite well: http://msdn.microsoft.com/en-us/library/aa271863%28v=vs.60%29.aspx

link

answered Sep 10 '12 at 18:38

Gert's gravatar image

Gert ♦
629141824

So make sure on the WRITING side of a socket: use htons() (or htonl()) - Convert a 16-bit quantity from host byte order to network byte order. [H]OST [to] [N]ETWORK [s]mall ([l]ong). Where host is your program (typically Windows, I guess). On the READING side of a socket: use ntohs() (or ntohl()) - Convert a 16-bit quantity from network byte order to host byte order. [N]ETWORK [to] [H]OST [s]mall ([l]ong).

(Sep 10 '12 at 19:26) Gert ♦

If one of the parties has this wrong - yes, that is fun, welcome to network programming ;-) Before you ask: no, chilkat can not determine if the other side has got this wrong when you receive bytes. They are just bits, zeroes and ones.

(Sep 10 '12 at 19:27) Gert ♦

Thanks Gert!

You are correct if the binary data represents integer or numerical values such as 16/32/64-bit integers, floating point values, etc.) If the data is simply bytes, such as image data, video, or anything else, then there is no byte order.

link

answered Sep 10 '12 at 21:39

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1

Asked: Sep 10 '12 at 16:12

Seen: 877 times

Last updated: Sep 10 '12 at 21:39

Related questions

powered by OSQA