<?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/7263" />

	<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>2004-04-15T19:58:04-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-04-15T19:58:04-04:00</updated>

		<published>2004-04-15T19:58:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35593#p35593</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35593#p35593"/>
		<title type="html"><![CDATA[Async socket]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35593#p35593"><![CDATA[
seems to be working tnx verry mutch<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Thu Apr 15, 2004 7:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-04-15T12:06:48-04:00</updated>

		<published>2004-04-15T12:06:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35563#p35563</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35563#p35563"/>
		<title type="html"><![CDATA[Async socket]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35563#p35563"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc open_sock {host port} {if {[catch {socket $host $port} sock]} {puts "Connection to $host:$port failed: $sock"} {fileevent $sock writable [list check_sock $sock $host $port]vwait ::done}}proc check_sock {sock host port} {if {[fconfigure $sock -error]==""} {puts "Connected to $host:$port"} {puts "Connection to $host:$port failed: [fconfigure $sock -error]"}close $sockset ::done 1}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Apr 15, 2004 12:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-04-14T12:41:19-04:00</updated>

		<published>2004-04-14T12:41:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35517#p35517</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35517#p35517"/>
		<title type="html"><![CDATA[Async socket]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35517#p35517"><![CDATA[
tryed it <br><br>when it becomes writable  set connect 1<br><br>then vwait connect<br><br>then if {$connect} {} .. tryed hehe what is it i am doing wrong i know it has to be something .. just can't put my finger on it ..<br><br>could maybe someone write a working example ?? doesn't matter how as long as its an async socket that checks if it connects yes or no  thats it<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Wed Apr 14, 2004 12:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2004-04-14T09:01:07-04:00</updated>

		<published>2004-04-14T09:01:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35512#p35512</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35512#p35512"/>
		<title type="html"><![CDATA[Async socket]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35512#p35512"><![CDATA[
You also have to wait for it to connect. Try using vwait or a loop with update.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Wed Apr 14, 2004 9:01 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-04-14T05:13:37-04:00</updated>

		<published>2004-04-14T05:13:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35508#p35508</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35508#p35508"/>
		<title type="html"><![CDATA[Async socket]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35508#p35508"><![CDATA[
Ok thats something i could of prevented didn't see but i rewrot that like 5 times so it doesn't do anything why is that ?<br><br>ive tryed this not once but like 50 times before and i always end up the same the socket connects closes can't check for writable and nothing happens<br><div class="codebox"><p>Code: </p><pre><code>#!/usr/bin/tclshproc open_sock {host port} {  catch {socket -async $host $port} sock  fileevent $sock writable [list check_sock $sock $host $port]}proc check_sock {sock host port} {  set error [fconfigure $sock -error]  close $sock  eval report_sock [list $error]}proc report_sock {error} {  if {[string match -nocase {} $error]} {    puts "socket connected"  }}open_sock [lindex $argv 0] [lindex $argv 1]</code></pre></div><blockquote class="uncited"><div>brain:~# ./sock 127.0.0.1 666<br>brain:~#</div></blockquote><blockquote class="uncited"><div>listening on [any] 666 ...<br>connect to [127.0.0.1] from localhost [127.0.0.1] 51639<br> sent 0, rcvd 0<br>brain:~#</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Wed Apr 14, 2004 5:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-04-14T05:14:39-04:00</updated>

		<published>2004-04-14T05:12:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35507#p35507</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35507#p35507"/>
		<title type="html"><![CDATA[Async socket]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35507#p35507"><![CDATA[
&lt;seemed to of posted it twice&gt;<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Wed Apr 14, 2004 5:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2004-04-14T00:24:53-04:00</updated>

		<published>2004-04-14T00:24:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35504#p35504</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35504#p35504"/>
		<title type="html"><![CDATA[Re: Async socket]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35504#p35504"><![CDATA[
<blockquote class="uncited"><div>...<br>cause i tryed this and it seems to be connecting all the time makes no difference wether it connects or not<br>...</div></blockquote>From what you posted, it seems like it does not show it to be connecting all the time... it instead shows an error all the time. You forgot an argument to fileevent, namely the socket.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Wed Apr 14, 2004 12:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-04-13T06:10:31-04:00</updated>

		<published>2004-04-13T06:10:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35482#p35482</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35482#p35482"/>
		<title type="html"><![CDATA[Async socket]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35482#p35482"><![CDATA[
I am having a hard time understanding async socket when it infact connects and when not ive seen several examples and read about it but can someone tell me what it is what i am doing wrong .. or give me an working example .. one that shows when u connect and when the connected failed cause i tryed this and it seems to be connecting all the time makes no difference wether it connects or not<br><br>tnx in advance<br><div class="codebox"><p>Code: </p><pre><code>#!/usr/bin/tclshproc open_sock {host port} {  catch {socket -async $host $port} sock  fileevent writable [list check_sock $sock $host $port]}proc check_sock {sock host port} {  set error [fconfigure $sock -error]  close $sock  eval report_sock [list $error] }proc report_sock {error} {   if {[string match -nocase {} $error]} {     puts "socket connected"   } }open_sock [lindex $argv 0] [lindex $argv 1]</code></pre></div>Error:<br><blockquote class="uncited"><div>open_sock [lindex $argv 0] [lindex $argv 1]<br>brain:~# ./sock 127.0.0.1 666<br>bad event name "check_sock sock3 127.0.0.1 666": must be readable or writable<br>    while executing<br>"fileevent writable [list check_sock $sock $host $port]"<br>    (procedure "open_sock" line 3)<br>    invoked from within<br>"open_sock [lindex $argv 0] [lindex $argv 1]<br>"<br>    (file "./sock" line 20)</div></blockquote>socket closes directly before it can check it is writable<br><blockquote class="uncited"><div>listening on [any] 666 ...<br>connect to [127.0.0.1] from localhost [127.0.0.1] 48096<br> sent 0, rcvd 0<br>brain:~#</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Tue Apr 13, 2004 6:10 am</p><hr />
]]></content>
	</entry>
	</feed>
