Hello guys,

long time no see. I already posted this on original RunUO forums but this seems really dead to me and I hope that you guys can help me with my problem.
Actually I am currently analysing the RunUO Core and the UO Protocol in network related points. So I try to learn from RunUO for example to implement the network technology simultaneously for other areas. Also, I've already studied the UO Protocol.
I am right now in the test phase and playing around sending some packets (self written c# socket client) against the core etc. But there came up a little problem. For example in my understanding I will need the following steps:

  • connect to the server [working]
  • send the seed packet (239)
    C#:
      serverStream.Write(new byte[] {239}, 0, new byte[] { 239 }.Length);

    First problem: It is working and the server accepts it as Packet 239(Seed).But it seems that the first packet is getting ignored, so I have to send this seed twice.
Same with my login packet:

  • connect to the server [working]
  • creating login packet
    C#:
    struct LoginPacket
            {
                public byte id;
                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 30)]
                public string name;
                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 30)]
                public string password;
                public byte next;
    
            }
    
            byte[] StructureToByteArray(object obj)
            {
                int len = Marshal.SizeOf(obj);
                byte[] arr = new byte[len];
                IntPtr ptr = Marshal.AllocHGlobal(len);
                Marshal.StructureToPtr(obj, ptr, true);
                Marshal.Copy(ptr, arr, 0, len);
                Marshal.FreeHGlobal(ptr);
                return arr;
            }
  • in function:
    C#:
    LoginPacket loginpacket;
                loginpacket.id = 128;
                loginpacket.name = "testuser";
                loginpacket.password = "123456789";
                loginpacket.next = 0x00;
  • sending it to the server:
    C#:
    byte[] outStream = StructureToByteArray(loginpacket);
                serverStream.Write(outStream, 0, outStream.Length);
                serverStream.Flush();
This is working because I am debugging the variables by using Visual Studio and printing it out to console. "testuser" and "123456789" is the output. But this only works if I send it twice. I hope we can find a solution for this very specific problem.



Ty guys
 
Back