ID:152781
Oct 17 2005, 1:37 pm
|
|
Anyone here familiar with the way Java handles sockets and what not. I can not seem to be able to send binary over sockets. I was using PHP to send data to the Byond world using sockets and it works fine. However I am having trouble duplicating in java. I always get the (hit enter to continue) returned. I have tried almost anything to send the hex and or binary values over in a byte like I do in php. But its getting converted to a number or a string and wont send it properly. So if anyone knows how to send the data over java I would be very thankful.
|
Oct 17 2005, 7:10 pm
|
|
Sockets are basically the same everywhere. If you post some code I'll have a look at it.
|
In response to Crispy
|
|
import java.io.*; I have tried all the different outputs but I can not send the correct data over Byond. Heh with PHP I managed it, and I can send java and php to each other.. but... the problem is I cant get java to send the hex or bytes to byond. |
In response to DoOmBringer
|
|
Firstly, the length of the message should be represented using 2 bytes, not 1. Secondly, the length of the message is not 0x15; it's 15. There's a difference. You either need to put 15, or 0x0F (which is 15 written in hexadecimal format).
test.writeChar(0x00); |
In response to Crispy
|
|
The length of the message is actually 21 bytes.. Hey Byond World + the 5 bytes before and the 1 byte following it. At least thats how it works in the PHP version. Thanks for the help though, I think Im getting closer to getting it to work.
|
In response to DoOmBringer
|
|
Alright its working now. The only thing missing was the empty byte before the length. Thanks alot Crispy, now I start development on my "secret" project heh.
|