• Welcome to Valhalla Legends Archive.
 

Starting over...

Started by Smarter, September 24, 2007, 06:25 AM

Previous topic - Next topic

Camel

Why do you have hex in your variable names? You should use descriptive names.

Also, you should use a packet buffer, so you don't need to describe the header each time you want to send a packet.


The data you are sending matches exactly what your code is doing; you insert the variable called Length with a value of zero and a size of 2 bytes, then a byte with the value of 0x10, and then a byte with a value of 4.

Camel

Quote from: Hdx on September 26, 2007, 01:17 AM
Also, if you're logging your own bot. http://wpepro.net/ thats a good packetlogger. Nice and simple, intuitive to use.

Ethereal >>>> wpe

Barabajagal

We figured it out blake. He was also sending the Product ID as a byte instead of a dword. And he's using a packet buffer, it just doesn't have BNLS handling.

Smarter

#18
:-D Yes, thanks to Andy's amazing 1 on 1 help, I was able to find the problem, I was dumbly treating BNLS packets as BNCS packets, and was having all kinds of problems sending/recieving them, now my current problem is my PacketBuffer, recieves the header fine, parses it, but when I go to get the rest of the data, it returns 0's:

My Listener:
        public void Listener()
        {
            while (sck.Connected)
            {
                byte packetID;
                int dataLength;
                byte[] packetData;

                try
                {
                    byte[] header = Recieve(3);
                    if (header[0] != 0xFF)
                    {
                        sck.Close();
                    }
                    packetID = header[2];
                    dataLength = BitConverter.ToInt16(header, 0) - 3;
                    main.AddChat("DataLength: " + dataLength, Color.Black);
                    packetData = Recieve(dataLength);
                    HandelPacket(packetID, packetData, dataLength);
                }
                catch (SocketException se)
                {
                    //chatModule.AddChat("Error: " + se.Message, Color.Red);
                }

            }
        }


My Recieve:
public virtual byte[] Recieve(int len)
        {
            byte[] incBuffer = new byte[len];
            int totRecv = 0;

            NetworkStream localNS = sck.GetStream();

            while (sck.Connected && totRecv < len)
            {
                try
                {
                    totRecv += localNS.Read(incBuffer, totRecv, (int)len - totRecv);
                }
                catch (Exception e)
                {
                    main.AddChat("Error: " + e.Message, Color.Black);
                }
            }
            return incBuffer;
        }


If anyone has any ideas.... packetData returns an 8 length array of "0x00" ....

Quote from: Hdx on September 26, 2007, 01:17 AM
Anyways. What language you working in.
- Read my first post, I said I was working in C# ("see sharp") :-D
Since '99

BrutalNet.Net