SRCDS Steam group


Source RCON protocol
#8
css Wrote:
gertjuhh Wrote:Problem is I can't use a timeout as I'm handling an irc connection aswell.
Why not?
The php-irc bot i'm building the module for already has some very nice socket functionalities.
It tells when there's any data to read and then allows me to work with it.
css Wrote:
gertjuhh Wrote:It's not so much the socket stuff that's causing the problem, but the inability to tell when i have received all data belonging to a single rcon request reply (being build up over 1 or more packages).
Hmm.. it seems you can't. None of the packets include the total length of the reply, so you'll just have to do some sort of timeout in the end. Now it starts to come back into my mind too. I remember using the same kind of "wait 0.5 seconds and assume all packets have arrived" style before doing the implementation I've got now. I guess that's the only way.
Shame really, but i gues it'll have to do for now...
css Wrote:
gertjuhh Wrote:You're first reading the first 4 bytes to get the package size, after which you read the length + ANOTHER extra 4 bytes. Which would come to a total of 4 (length field) + packagesize + 4. I have never had the problem of where the first 4 bytes would not contain the actual package length
See the flags, I'm just peeking Wink
Code:
$sock->recv($buffer, 4, MSG_PEEK); # Peek size field (32b int)
The MSG_PEEK flag doesn't remove the data from the queue, so the next time I do call to recv, the first four bytes are still the size field. I don't remember exactly why I came up with this solution, but it's probably got something to do with not getting into infinite blocking read if there's no reply from the server - although that's exactly what will happen Toungue
Whoops, sorry about that.
I didn't read up on those flags cause I use other functions to work with sockets.
Still I've never had a packet not include the packet size.
Sometimes a packet is send over 2 'tcp replies' (make any sence??), are you taking that into account?
Before i made a fix for this I did have some 'broken' packets

raydan Wrote:i have a java rcon source code, that can connect multi servers and send many rcon commands to all server at the same time by using thread.
How is this relevant to the discussion!?
Reply


Messages In This Thread
Source RCON protocol - gertjuhh - 10-02-2008, 02:54 AM
RE: Source RCON protocol - css - 10-02-2008, 04:05 AM
RE: Source RCON protocol - gertjuhh - 10-02-2008, 04:56 AM
RE: Source RCON protocol - css - 10-02-2008, 07:56 AM
RE: Source RCON protocol - gertjuhh - 10-02-2008, 08:27 PM
RE: Source RCON protocol - css - 10-02-2008, 10:05 PM
RE: Source RCON protocol - gertjuhh - 10-02-2008, 06:38 AM
RE: Source RCON protocol - raydan - 10-02-2008, 12:35 PM
RE: Source RCON protocol - css - 10-02-2008, 05:33 PM
RE: Source RCON protocol - css - 10-05-2008, 09:04 PM
RE: Source RCON protocol - gertjuhh - 10-06-2008, 11:33 PM
RE: Source RCON protocol - gertjuhh - 10-07-2008, 02:34 AM
RE: Source RCON protocol - css - 10-07-2008, 03:27 AM
RE: Source RCON protocol - gertjuhh - 10-07-2008, 05:29 AM
RE: Source RCON protocol - gertjuhh - 10-17-2008, 05:49 AM
RE: Source RCON protocol - css - 10-17-2008, 08:36 AM
RE: Source RCON protocol - gertjuhh - 10-17-2008, 03:41 PM
RE: Source RCON protocol - css - 10-17-2008, 04:30 PM
RE: Source RCON protocol - css - 10-18-2008, 01:01 AM
RE: Source RCON protocol - gertjuhh - 10-19-2008, 07:30 PM
RE: Source RCON protocol - css - 10-20-2008, 12:47 AM

Forum Jump:


Users browsing this thread: