Hello all.
Please help me to read and write bytes via Socket.
For example, assumed that I want to send 5 bytes [0x00, 0x01, 0x7f, 0x80, 0xff] to a TCP server.
I did:
(with-open [s (java.net.Socket. "ip.of.test.server" port_of_test_server)]
(let [^java.io.BufferedWriter wtr (writer s)
^chars obuf (char-array (map char [0 1 127 128 255]))]
(.write wtr obuf 0 5)
(.flush wtr))))
Then, my test server received bytes: [0x00, 0x01, 0x7f, 0xc2, 0x80, 0xc3, 0xbf].
* I think I should use a char array so that read() requires 'char[]'.
* What is the valid char value to send a byte 0x80?
* How can I make the char value from 0x80 int?
* How are things about read.
* Does character encoding environment affect? (I use -Dfile.encoding=UTF-8)
Thank you in advance.
Yoshinori Kohyama