Hi guys,
so I feel like I'm going to have to mess around with java functions for a while because this is confusing me.
I have a java server and a GML client, the client sends information to java via buffers, it has a few data types, string, u8, u16, signed too, long and so on. I could work with all that because I knew that I wanted to use the relevant data type as in if i'm working with strings I'll use the buffer_string type, if I'm working with small values up to 256 i think I'd use buffer_u8, and so on keeping the buffer size large enough for it's purpose and not much larger. Now that I have a java server a few things confuse me, things that happened behind the scenes with Game maker studio, for 1 there is overhead stuff that was going on, there's an option with gml that lets you choose between gml overhead stuff and the other that removes that.. the overhead was like handshaking or something like that.. I believe there are other things that also play a role like sending buffer sizes. But I might be wrong.
What I need to do is see exactly what is being sent from the gml client, I don't know how to do that, what I've tried is sending an u8 value 0-256 ( i believe) from gml client to java server receiving as type "Short", I sent a single value of '5'. Now what I don't understand is that there has to be more to it, I'm not receiving this 'buffer_size' that gml is supposedly sending. or rather if I am then how do i see it ?
Which brings me to array of bytes, I know what an array is, I dont really know what bytes are and yet I work with them, I know they're larger than bits and smaller than kilo bytes, a way of measuring the size of something, but what exactly ?
When I am streaming data back of forth regardless of data type, am I simply sending bytes back and forth ? The reason I ask is because I don't have a good understanding of how to set up the code on the server and possibly on the client to receive the information properly and in order.
Originally in GML the client for example will send a string/integer/etc to the server, it will tell the server the size of the string and the data type used so that the server knows that a string is being received and this is the size of it, honestly I never asked why the size of it mattered. couldn't it just read until a line break or something ? I'm sure the devs of the language had their reasons, I'm primarily concerned with what's relevant to my problem. Anyway and the server will read it, that was all there was to it for me. now with java I believe there's much more to it, in java I don't see functions like..
output = new DataOutputStream(my_Sock.getOutputStream());
output.writeString
output.write'u8
output.write'u16
It doesn't seem as simple as that, well I do see I've got writeInt and writeChars which seems like what I would think about using, but under writeInt F2 brings this up:
-
writeInt
public final void writeInt(int v) throws IOException
Writes anint
to the underlying output stream as four bytes, high byte first. If no exception is thrown
I've no idea what writing something as four bytes means, and high byte first ? what's a high byte. In fact when ever it talks about bytes and so on I'm expecting this stuff to be sent/received, so I'm expecting that four bytes of data is going to be sent if I use output.writeInt(...); but I'll pretend to know what bytes are and say what if I use values in the writeInt method larger than four bytes?
As you can see there's a lot of confusion here but to the trained eye someone might be able to suggest a course of action like what manual or such can I look at to get a better understanding of what's going on here.
Whilst I just leave this here and hope someone picks it up I'll be reading on further, thanks for reading hope to get some replies.