<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/4503" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2003-06-03T11:05:58-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/4503</id>

		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2003-06-03T11:05:58-04:00</updated>

		<published>2003-06-03T11:05:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=21178#p21178</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=21178#p21178"/>
		<title type="html"><![CDATA[Need some help with sockets..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=21178#p21178"><![CDATA[
Hi, about the async sockets... you can't check for the error until the socket has had some time to try to connect. Use 'fileevent writable' and 'fileevent readable' to set up a callback. Technically you should only have to use the 'writable' event, but the tcl docs are a bit unclear. Anyway, once the async socket is marked readable/writable, that means that it's either connected or in an error state.&lt;br&gt;<br>&lt;br&gt;<br>Also, you may want to use eggdrop's dns commands instead of calling 'socket' right away, because eggdrop's are nonblocking. Not an issue if you always use ip addresses of course.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Tue Jun 03, 2003 11:05 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-05-28T04:17:55-04:00</updated>

		<published>2003-05-28T04:17:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=20833#p20833</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=20833#p20833"/>
		<title type="html"><![CDATA[Need some help with sockets..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=20833#p20833"><![CDATA[
If you want to do it all in one proc you should avoid using -async<br><br>Use catch to fetch the error message (if any) when opening the socket fails. Eg: <div class="codebox"><p>Code: </p><pre><code>if {[catch {socket $a $p} e]} {    # $e is the error message} {    # connected...$e is the socket id    # ...so close it and tell the user the port is open    close $e}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed May 28, 2003 4:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2003-05-28T03:45:50-04:00</updated>

		<published>2003-05-28T03:45:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=20829#p20829</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=20829#p20829"/>
		<title type="html"><![CDATA[Need some help with sockets..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=20829#p20829"><![CDATA[
OK This is what I am trying to do:<br>Whenever I say "&lt;botnick&gt; scan &lt;host&gt; &lt;port&gt;" the bot is supposed to open a tcp socket to &lt;host&gt; &lt;port&gt;. <br>However, I need to check if the socket has opened (ie if the port is open on that host  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cool.gif" width="15" height="15" alt="8)" title="Cool">).. <br>This is my script:<br><br><div class="codebox"><p>Code: </p><pre><code>proc scan_test { nick uhost handle channel text } {set host [lindex "$text" 0]; set port [lindex "$text" 1]; set z [socket -async $host $port]; putquick "privmsg $channel :Scanning $host on $port.."if {[fconfigure $z -error] == "connection refused"} { puthelp "privmsg $channel :Port Closed: $port"; } elseif {[fconfigure $z -error] == ""} { puthelp "privmsg $channel :Port Open: $port" }close $z}bind pub - scan scan_test</code></pre></div>Now.. On to the problem.. Even if a port is closed, fconfigure $z -error ALWAYS evaluates to "" (which should be the outcome of a SUCCESSFUL connection) Any ideas on what I can do? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><p>Statistics: Posted by Guest — Wed May 28, 2003 3:45 am</p><hr />
]]></content>
	</entry>
	</feed>
