bind dcc n| sock dcc:sock
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]
catch {socket $host $port} bla
if {[string match "sock*" $bla]} {
putdcc $idx "connection established."
return
}
putdcc $idx "$bla"
}
when I run an *test* he pings timed out. My local (lan) tests where ok, the internet ones he dies (ping timedout or something). Also I have tryed using the connect but I haven't understood exactly how to *control* it. I haven't got an successful thing with it, duno why. An example or something will be nice.
Once the game is over, the king and the pawn go back in the same box.
This sounds weird...if you don't get a reply from the host you're connecting to the connection should time out within less than a minute (the minimum time it would take your bot to ping timeout)
Try using -async when creating the socket, fconfigure it -blocking 0 and set up a fileevent $bla writable ... dealing with checking the connection. This way there should be no ping timeout no matter how [censored] up your system is
here's an alternative method of using catch to figure out if there's an error or not when opening the socket:
if {[catch {socket ...} bla]} {failed...$bla is the error msg} {connected...$bla is the socket id}