Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP --> VBScript Encoding Issue? (UDP server query)

Status
Not open for further replies.

JavaDoctor

Technical User
Nov 26, 2004
7
GB
Hello, I just sorted out connecting to a Games Server via UDP with a socket from Catalyst courtesy of assistance from another thread.

The connection is working and giving me a disconnect message which tells me it is working but I need to send a diferent query string. I have a query string that works in PHP but can't see how to create it with VBS. The PHP string is:

$send = "ÿÿÿÿ" . chr (0x02) . "getstatus";

(this gets the server to send back a list of it's current game parameters and players/scores etc)

I believe that ÿ = Chr(255) Alt+0255 but what is chr (0x02) ? I have tried sending chr(02) and chr(2) but I don't think it is being recognised.

If I send a single word string as a query I get back ÿÿÿÿdisconnect as a response; if I send something that looks like the above query string
I have tried all sorts of variations to no avail.

Does this make any sense? :)
Any help or pointers appreciated.



 
Hello JavaDoctor,

A couple of modifications are needed to work with vbs. [1] $send is illegal in vbs for string, must start with some alphabet or undercore... [2] concatination is "&". Hence, in vbs it is this.
[tt]
send=string(4,chr(255)) & chr(2) & "getstatus"
'or
send=string(4,chr(&hff)) & chr(&h02) & "getstatus"
[/tt]
regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top