|
Luigi Auriemmaaluigi.org (ARCHIVE-ONLY FORUM!) |
|
It is currently 19 Jul 2012 19:10
|
View unanswered posts | View active topics
|
Page 1 of 1
|
[ 5 posts ] |
|
Author |
Message |
lkj
|
Post subject: C rcon function Posted: 05 Jan 2009 13:19 |
|
Joined: 05 Jan 2009 13:01 Posts: 6
|
Hi Luigi, could you write me a function which sends an rcon command and returns the answer? Something like char *SendRcon(char *ip, int port, char *pw, char *msg) and it returns something like "kicked player xy" or "no rcon set" or "server is offline" or ... Important is just I need it as one function only + the header files. If possible, C++ would be better but C is no problem.
|
|
Top |
|
|
|
|
|
|
|
aluigi
|
Post subject: Re: C rcon function Posted: 05 Jan 2009 17:03 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
the attached code is a good example not only for this sendrcon thing but also and moreover for a basic udp program to learn how to use sockets.
FILES UPDATED 06 Jan 2009
Attachments: |
File comment: full version which handles more replies from the server through the handling of the timeout (default 2 seconds)
sendrcon_full.c [2.47 KiB]
Downloaded 136 times
|
File comment: quick version, easy socket example
sendrcon_simple.c [1.82 KiB]
Downloaded 122 times
|
|
|
Top |
|
|
lkj
|
Post subject: Re: C rcon function Posted: 06 Jan 2009 11:55 |
|
Joined: 05 Jan 2009 13:01 Posts: 6
|
Thanx! Basically it works fine but when the answer has more then one line it shows me the first one only. Like status in your example. It just shows me print <break> map: <mapname>. No players, ips, ports (...) although players are in... Can you fix this?
|
|
Top |
|
|
aluigi
|
Post subject: Re: C rcon function Posted: 06 Jan 2009 14:57 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
the fact is that rcon should be handled in real-time and not with a stand-alone function, because in this case the only "fix" is the of handling the timeout, so if you don't receive a reply after one or two seconds it returns.
I have added this code to the previous post using a timeout of 2 seconds, if you want a different timeout set it in the "!timeout(sd, 2)" instruction. oh, the sendrcon_full.c version automatically remove the "print" message of the server making it more readable
|
|
Top |
|
|
lkj
|
Post subject: Re: C rcon function Posted: 07 Jan 2009 12:47 |
|
Joined: 05 Jan 2009 13:01 Posts: 6
|
Ok Thanx! That's what I'm searching for.
|
|
Top |
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|