1) You should use char as bytes and not as characters.
I mean, you send the character "0" as payload Type.
But the char "0" as not the byte value 0x00 that is the type of a ping. So send 0x00 instead of "0". You should act like this for all the other fields.
2) in you message you say you receive OK from a remote client. Have you send OK too as the draft speficy it (section handshake) before send the ping?
Hope this could be helpful
regards, |