This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

TCL UDP Q3 rcon problem

Old posts that have not been replied to for several years.
Locked
C
Chack

TCL UDP Q3 rcon problem

Post by Chack »

Ok, I am using the following tcl script to send a command to a q3 server. It should also receive data back from it, but that just doesn't work.

I use the tcludp extension that can be found here:
http://www1.cs.columbia.edu/~xiaotaow/research/tcludp/

The command was successfully sent to the server (the game password changed), but the confirmation answer of the server was not received.

.rcon X.X.X.X 27960
-> sending rcon cmd
-> rcv
-> Tcl error [dcc:sock]: can not find channel named "sock19"

looks like the socket get's closed before I close it myself. Maybe this is the reason why i can't receive data? I don't know :/

Code: Select all

load /opt/tcl/lib/udp1.0.5/libudp1.0.5.so

bind dcc n| rcon dcc:sock

proc udp_read {socket} {
        putlog "rcv"
        while {[gets $socket line] >= 0} {
                putlog "$line"
        }
        close $socket
}

proc dcc:sock {hand idx text} {
        if {[llength $text] < 2} {
                putdcc $idx "Usage: sock <ip> <port>"
                return
        }
        set host [lindex $text 0]
        set port [lindex $text 1]
        set s [udp_open]
        udp_conf $s $host $port
        puts $s "ÿÿÿÿrcon rconpassword g_password test"
        putdcc $idx "sending rcon cmd"
        fconfigure $s -buffering full -translation auto
        fileevent $s readable [udp_read $s]
}
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Could have something to do with the syntax of fileevent.

instead of fileevent $s readable [udp_read $s], try this:

fileevent $s readable [list udp_read $s]
Locked