Gr3enP0ison

Member
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
 

Active Shards

  • Insane UO
    Endless Journey
    • Players
    • 105 Online
    • 128 Peak
  • Unchained
    Custom (Classic)
    • Players
    • 103 Online
    • 273 Peak
  • UO Eventine
    Custom (Classic)
    • Players
    • 95 Online
    • 137 Peak
  • The Crossroads
    Mondain's Legacy
    • Players
    • 78 Online
    • 190 Peak
  • UO: New Renaissance
    Custom (Classic)
    • Players
    • 53 Online
    • 85 Peak
  • Arth
    Custom (Modern)
    • Players
    • 34 Online
    • 46 Peak
  • UO Enigma
    Custom (Modern)
    • Players
    • 33 Online
    • 172 Peak
  • CALYPSO
    Custom (Modern)
    • Players
    • 28 Online
    • 30 Peak
  • UO Phoenix
    Custom (Classic)
    • Players
    • 28 Online
    • 48 Peak
  • Pandora
    Custom (Modern)
    • Players
    • 15 Online
    • 32 Peak

Donations

Total amount
$0.00
Goal
$500.00
Back