Valhalla Legends Forums Archive | General Programming | [VB.net] Reading incoming data =x

AuthorMessageTime
PunK
I'm writing a listening server in .NET but in the process, having some issues. So hopefully someone can clear it up.

I've gotten as far as accepting the client, passing the TCP client to a class to separately handle the socket. But what has me stumped is reading the data coming from the actual client. It's pulling the data from the stream, however, I'm afraid the data is incorrect ??

I'm connecting a battle.net bot to the server, so I should see 0x50, right? But I don't... it's outputting that the packet as 0x80? I'm getting frustrated with this.

[code]
   Private Sub ClientDataArrival()
       Dim i As Int32
       Dim bytes(1024) As [Byte]
       Dim data As String

       While (True)

           Dim socketStream As NetworkStream = clientSocket.GetStream()
           i = socketStream.Read(bytes, 0, bytes.Length)

           While (i <> 0)
               data = System.Text.Encoding.ASCII.GetString(bytes, 0, i)

               printf(Asc(Mid(data, 2, 1)))            '0x80??? wtf

               Dim msg As [Byte]() = System.Text.Encoding.ASCII.GetBytes(data)

               'send data back to client for shits
               socketStream.Write(msg, 0, msg.Length)

               i = socketStream.Read(bytes, 0, bytes.Length)

           End While

       End While
   End Sub
[/code]

Here is a packet dump of what I am getting from the stream...
[code]
0000:  01 3F 50 3A 00 00 00 00 00 36 38 58 49 56 44 32  ?P:.....68XIVD2
0010:  44 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00  D ..............
0020:  00 00 00 00 00 00 00 00 00 55 53 41 00 55 6E 69  .........USA.Uni
0030:  74 65 64 20 53 74 61 74 65 73 00                  ted States......
[/code]

Btw, if someone could kindly move this to general programming forum, that would be great :)
October 4, 2009, 5:54 PM
Camel
I'm not a .NET programmer, but I know that binary packet data is not ASCII.
October 5, 2009, 5:27 PM
JoeTheOdd
That packet header is wrong, for one thing. The 0x3F should be 0xFF.
October 5, 2009, 7:10 PM

Search