First of all, your packet size is wrong.

> This is what is being sent:
>
> 13 0 0 0 1 0 0 0 51 114 99 111 110 112 119 0 0 0
> (decimal).
>
> The test server is launched with -port 27016.
>
> When I send it to 27015 TCP I get this error:
> An existing connection was forcibly closed by the remote host
> On this line:
> m_socket.Receive(buffer, 16, Net.Sockets.SocketFlags.Partial)
>
> When I send it to 27016 TCP I get this error:
> No connection could be made because the target machine actively refused it
> 127.0.0.1:27016
> On this line:
> m_socket.Connect(m_ip, m_port)
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Sebastian
> Staudt
> Sent: Thursday, 5 March 2009 6:45 AM
> To: Discussion of Half-Life Programming
> Subject: Re: [hlcoders] RCON in VB.NET
>
> Yes, I left that out as I mentioned it before. I'm always thinking in C++
> data types. :)
> Same applies to Java / C#. So be sure to use Integer.
>
> 2009/3/4 Tom Leighton <[email protected]>
>
>> In VB.NET, the datatype "Long" is 8 bytes (64 bits), and the datatype
>> "Integer" is 4 bytes (32 bits). If he uses Long in VB.NET, it won't work.
>>
>> Sebastian Staudt wrote:
>> > 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
>> >
>> >
>> >
>>
>> _______________________________________________
>> 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