Dedicated Server API Client Communication

Discuss the Dedicated Server Tools developed by Nadeo Live such as ManiaLive, Trust Circles, Dedicated Manager, Competition Manager and Lobbies

Moderator: NADEO

The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: Dedicated Server API Client Communication

Post by The_Big_Boo »

After fiddling with this a bit, I found a drawback and I'm not sure what to do with it... XMLRPC has two particular types, base64 and dateTime.iso8601, which aren't handled very nicely by the xmlrpc extension. To encode them, you have to call xmlrpc_set_type which actually wraps them into small objects and the decoding returns objects for them.

For dateTime, I don't think it's used by the dedicated in any method or callback so nobody probably care if encoding/decoding doesn't give the same results in both functions (xmlrpc one and mine).
However, base64 is useful for tunnelling data and writing files. Encoding isn't an issue as an object is already used (I just modified it a bit so it works in both functions) but decoding is: it was usually sending back only the decoded string so this is what I'm doing in my function but the xmlrpc returns an object... Two solutions:
- my function returns an object
=> it'll break any project using the TunnelDataReceived callback and the GetValidationReplay method
- strings from the xmlrpc return are unwrapped
=> it needs to use array_walk_recursive but it's so slow (around x3 factor) it makes it even slower than my function for small requests...

I'm prefering the first one, as it's easily fixable:
- the method return can be unwrapped in the Connection class directly (so it's not even a real issue ^^)
- the callback is generally handled by a callback manager which can then do the unwrapping

But if anyone has another point of view or another solution, feel free to share it ^^


Edit: I did the first choice, feel free to test!
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
User avatar
TGYoshi
Posts: 795
Joined: 15 Mar 2011, 16:59

Re: Dedicated Server API Client Communication

Post by TGYoshi »

https://github.com/NewboO/dedicated-ser ... e.php#L169
Shouldn't you read until you have 8 bytes total? Assuming you always read 8 bytes can go.. wrong, even though it's usually the case, it doesn't have to be as far as I know.
=3
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: Dedicated Server API Client Communication

Post by The_Big_Boo »

TGYoshi wrote:Shouldn't you read until you have 8 bytes total? Assuming you always read 8 bytes can go.. wrong, even though it's usually the case, it doesn't have to be as far as I know.
Indeed! Fixed by factorizing readings and writings (though there's a single write in the whole code), which also means that changing to socket_* functions would be easier if ever done.
kremsy wrote:But there should be a way to get all Methods working, getValidationReplay is very important for Dedimania Communication for example :).
As I said, GetValidationReplay wasn't a real issue and should still be giving the same result as before ;) Only TunnelDataReceived callback is broken but you only need to change "$data" by "$data->scalar" (or whatever you called the third parameter, the important part is adding "->scalar" anyway ^^)
kremsy wrote:Thank you soo much, I will try it out as soon as it is finished ;).
It's supposed to already be finished ^^ It just needs more tests to find bugs and maybe a bit of tweaking, so you can already try it :thumbsup:
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: Dedicated Server API Client Communication

Post by The_Big_Boo »

What's the server name? I'll investigate to see if anything can be done in the library or if it comes from dedicated itself. Also, did you let the default read timeout or set a custom one?

kremsy wrote:And on line 74 are two undeclared variables used:

Code: Select all

if($size != 11 || $protocol != 'GBXRemote 2')
size and protocol

same on line 188
Don't worry, they are declared (else the library couldn't work at all) thanks to the call to extract(). This function can make code a bit weird to read (especially when you don't know what it does ^^) but it shouldn't be a problem in this case as the variables which will be extracted are named in the unpack() call just before.
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
User avatar
Slig
Posts: 637
Joined: 15 Jun 2010, 11:52
Location: TraXicoLand

Re: Dedicated Server API Client Communication

Post by Slig »

The_Big_Boo wrote:Don't worry, they are declared (else the library couldn't work at all) thanks to the call to extract(). This function can make code a bit weird to read (especially when you don't know what it does ^^) but it shouldn't be a problem in this case as the variables which will be extracted are named in the unpack() call just before.
Mybe initialyse both variables before the unpack(), to avoid warning if the code using your lib have increased the warning verbosity/level ?


@kremsy: strange to get such problem specifically with GetServerName(), i never notice such thing. You are sure that you don't have some weird char in the server name (I mean wrong utf8 codes) ? That *should not* break the connection, but finding which case produce it will help to solve. Other idea : you tried with another php version ? maybe you get an issue linked to a php bug...
Post Reply

Return to “Dedicated Server Tools”

Who is online

Users browsing this forum: No registered users and 2 guests