Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Lance

Pages: 1 ... 5 6 [7] 8 9
91
General Programming / Re: [Java] Buffer Problems (Again)
« on: July 21, 2008, 01:02:57 pm »
That's alot of extra code ;;
There isn't a shorter way to do this?

92
General Programming / Re: [Java] Buffer Problems (Again)
« on: July 19, 2008, 10:24:26 am »
Quote from: Camel!
You can't use a Writer for binary data. Writers are to Streams as Strings are to byte arrays. You need to use byte arrays for binary data; if you Strings, you can be guaranteed that your code will work inconsistently in different environments.

Even if you use a Stream, Print* is still inappropriate for sockets (but not because it won't work). You should use a packet buffer to construct your packets and convert them to a byte[], and then write() that directly to the socket's OutputStream, thus making the write operation atomic, fault-resistant, and thread-safe.
That's it, right? :p

I have the Buffer class from JavaOP2 available but I have no idea how to use it for input streams :p

93
JavaOp Support Archive / Re: Not Logging Onto BNet, Help Please!
« on: July 18, 2008, 08:33:45 pm »
Just do a file search. Doesn't mac have one of those functions?

94
General Programming / Re: [Java] Buffer Problems (Again)
« on: July 18, 2008, 05:45:32 pm »
Link to the links please? I searched through BNUBot support forums and your recent posts ;;

95
General Programming / [Java] Buffer Problems (Again)
« on: July 17, 2008, 11:02:53 pm »
I have JavaOP2 receive packets (non-battle.net ones). I am currently modifying the core to meet my needs.

This works:
Code: [Select]
byte []packet = new byte[127];
                    input.read(packet);
but I have to specify the size which is completely inaccurate and it throws off my data by adding lots of 0x00's. I need a solution to this problem ;(

The traditional
Code: [Select]
int len1 = (input.read() & 0x000000FF);
                    int len2 = (input.read() & 0x000000FF) << 8;

int length = len1 | len2;

byte []packet = new byte[length];

for(int i = 0; i < packet.length; i++)
                        packet[i] = (byte)input.read();
results in my incoming packets not processing for some reason.

Ron said something about looping through each byte but I am still pretty new to java :p

Thanks :)

96
Ron saved the day  ;D

98
Ah.  Somewhere in BNetPacket class or Buffer class, the buffer has FF added to it and something else before the actual data is placed in the buffer according to some comments in the code but I cannot find where it's done so I can remove the block of code. Anyone know where it is?

100
How do I register the packets that I am going to receive? If the packet starts with 0x1 do I
Code: [Select]
register.registerIncomingPacketPlugin(this, 1, null);
?

Because it's not working ;;

101
General Programming / [Java] Reading from an already open socket
« on: July 14, 2008, 12:58:04 pm »
How can I listen to a socket opened by another program? Let's say I just logged on BNET with JavaOP2 and I received the ENTERCHAT packet. I want to view the contents of that packet in my program x3

102
JavaOp Support Archive / Re: JavaOP Logon Sequence Modification
« on: July 12, 2008, 04:42:10 pm »
Found it. Thanks  ;D

103
JavaOp Support Archive / JavaOP Logon Sequence Modification
« on: July 12, 2008, 02:19:43 pm »
I have JavaOP2 loaded into eclipse.
I would like to change the packets that are sent to the server when a successful connection is made (I don't want 0x01) (Experimenting with some stuff -- and this will not be connecting to a BATTLE.NET server) and change how JavaOP2 responds to what the server sends. But I'm interested more in the sending part :P.

In what package can I find the classes to change this stuff? Thanks

104
Trash Can / <Delete>
« on: July 12, 2008, 12:37:04 am »
Another one of my silly questions. Delete please  :-[ and thanks  :)

105
General Programming / Re: [Java] Incorrect Buffer Output
« on: July 11, 2008, 08:48:46 pm »
So this is going to be converted from hex to dec then put into a byte array and I'll be using a byte stream instead of Writer.
Sounds pretty easy :o

Sorry I completely misunderstood your first post

and Thanks :)

Pages: 1 ... 5 6 [7] 8 9