Sunday 15 January 2012

sockets - Java websocket server receives not plain text when client sends strings -



sockets - Java websocket server receives not plain text when client sends strings -

hei guys,

i'm building own websocket server, larn something.

now have java socket server establishes successful client when send client "test", receive "?„þdl»ŠÏ". different receive.

there no line end, nothing. i'm reading out inputstream.read(). handshake in plain text , works wonderful.

i've looked @ websocket info format, don't how should utilize it.

slightly duplicate websocket java server. not sending message nor receiving --> don't it, anyway.

thanks suggestions!

the info client sends masked. must info frame , unmask it.

the unmask function should this:

var decoded = ""; (var = 0; < encoded.length; i++) { decoded[i] = encoded[i] ^ mask[i % 4]; }

read: https://developer.mozilla.org/en-us/docs/websockets/writing_websocket_servers#step_2.3a_exchanging_data_frames

this tutorial of how develop websocket server in c#, similar java.

java sockets web websocket

No comments:

Post a Comment