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.

server socket -> crash on rehash

Old posts that have not been replied to for several years.
Locked
User avatar
ex
Voice
Posts: 14
Joined: Wed May 18, 2005 11:04 pm
Location: Chicago

server socket -> crash on rehash

Post by ex »

Code: Select all

proc Server {channel clientaddr clientport} {
   putlog "Connection from $clientaddr registered"
   puts $channel "[channels]"
   close $channel
}

socket -myaddr "cyberscripters.org" -server Server 63322
i have this out of a manual. but my problem is, that the eggdrop crashs when rehashing with the errormessage, that this port is already mapped.

is there a command like info exists for ports?
or should i first try to reach the port and only if closed open it again?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

You could use the "catch" command to catch the error. Or use "info exists" with another variable like "already_loaded" and set it when your script is loaded.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Some time ago I made an example based on an existing script (see the top few lines of the script):

Go to http://members.fortunecity.com/eggheadtcl/

and then find the script "sockreport.tcl"
G
Galadhrim
Op
Posts: 123
Joined: Fri Apr 11, 2003 8:38 am
Location: Netherlands, Enschede

Post by Galadhrim »

the system often has a timeout perioud before actually releasing the socket, because a) someone might be trying to send data to the socket and its on its way b) a local program might be trying to send data to the other end and it hasnt been accepted yet so it waits for a conformation.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

when you rehash the bot trys to rebind on the same port which could cause a crash => try this

Code: Select all

if {[catch {socket -myaddr "cyberscripters.org" -server Server 63322} s]} {
  putlog "Already binded to cyberscripters.org:63322"
} else {
  putlog "Binded to cyberscripters.org:63322"
}
like stdragon suggests
XplaiN but think of me as stupid
Locked