I was a bit quick on my first reply. Forgot to add the packet size (long) at
the beginning and the packet type has to be long to.
Back to the posted code:

Argument s1 of _Write should not be optional, but I think that's not the
problem.
Like Ronny said before the problem is the conversion from variables to
packet data.

I have no experience in VB.NET, but this line for example is wrong:
Dim sendData_CMD As Byte() = (New Text.ASCIIEncoding()).GetBytes(cmd)

Your variable cmd is what I called "packet type", this should be long
integer, but you use String.

Maybe you should use a packet sniffer (or simple hex output) to see your
resulting packet data. This often helps, when debugging protocol code.

2009/3/4 Ronny Schedel <[email protected]>

>
> No, it's there. It must be there, because of the terminating 0. Sure,
> currently the string itself is empty, but this is future future-proof.
>
>
> > You have also neglected the fact that the s2 string should ALWAYS be
> > null (or Nothing in vb.net), as per the wiki.
> >
> > Ronny Schedel wrote:
> >> I have to correct myself, the integers for size and request ID are 4
> >> byte,
> >> not only 2 like in the example.
> >>
> >>
> >>
> >>> I never coded in .NET but your write functions looks a little bit
> >>> overloaded. I have some experience in VBA, so is it not possible to
> >>> concat
> >>> the packet like this?
> >>>
> >>> private const SERVERDATA_EXECCOMMAND = 2
> >>> private const SERVERDATA_AUTH = 3
> >>>
> >>> dim send_data as string
> >>> send_data = chr(size_low) + chr(size_high) + chr(req_low) +
> >>> chr(req_high)
> >>> +
> >>> chr(SERVERDATA_EXECCOMMAND) + chr(0) + string1 + chr(0) + string2 +
> >>> chr(0)
> >>>
> >>> You have to calculate the packet size and split it in low and high
> byte,
> >>> but
> >>> it is not difficult.
> >>>
> >>> Best regards
> >>>
> >>> Ronny Schedel
> >>>
> >>>
> >>>
> >>>> I'm trying to port the PHP code I found a while back and I can't get
> it
> >>>> to
> >>>> work.
> >>>>
> >>>> This is what I'm using to call the functions:
> >>>>
> >>>> Dim rcon As New rcon_php
> >>>>      rcon.SetServer("127.0.0.1", 27015)
> >>>>      rcon.SetPassword("rconpw")
> >>>>      rcon.Auth()
> >>>>
> >>>> And my rcon_php class (or what I have so far) can be found at
> >>>> http://pastebin.com/f6c334344
> >>>>
> >>>> The test server is running on port 27016 (UDP).
> >>>>
> >>>> When I try connect RCON on 27015 TCP the server closes the socket when
> >>>> Auth() calls _PacketRead()
> >>>>
> >>>> When I try connect RCON on 27015 TCP the server actively refuses the
> >>>> connection
> >>>>
> >>>> Note that the line m_socket = m_socket is so I can mouseover while the
> >>>> program is paused and see the various properties.
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> To unsubscribe, edit your list preferences, or view the list archives,
> >>>> please visit:
> >>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >>>>
> >>>>
> >>> _______________________________________________
> >>> To unsubscribe, edit your list preferences, or view the list archives,
> >>> please visit:
> >>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >>>
> >>>
> >>
> >>
> >> _______________________________________________
> >> To unsubscribe, edit your list preferences, or view the list archives,
> >> please visit:
> >> http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >>
> >>
> >>
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to