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

	<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>2001-10-31T03:17:00-04:00</updated>

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

		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2001-10-31T03:17:00-04:00</updated>

		<published>2001-10-31T03:17:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1248#p1248</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1248#p1248"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1248#p1248"><![CDATA[
From the tcl command manual page you read:<br><br>In the first form, the read command reads all of the data from<br>channelId up to the end of the file.<br><br>I think that pretty much explains the problem... you are trying to read all the data from the socket up to the end of file... for a socket, that means until the connection is closed. So it's going to freeze until the socket is closed, which may be quite a while.<br><br>Your whole script is designed wrong. You need to use nonblocking sockets (read 'fconfigure') and file events (read 'fileevent') to do this.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Wed Oct 31, 2001 3:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-30T16:31:00-04:00</updated>

		<published>2001-10-30T16:31:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1224#p1224</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1224#p1224"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1224#p1224"><![CDATA[
Is there no better way to read a socket?<br>When the sock is open the eggdrop do not response <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":sad:" title="Sad"><div class="codebox"><p>Code: </p><pre><code> while {[validsock $sock]} {  set text [read $sock]  msn:putchan "user" "$text"  putlog "msn: $text"  if {[lindex $text 0] == "BYE"} {   close $sock   }}proc validsock {channel} {return [expr 1 - [catch "fconfigure $channel"]]}</code></pre></div><p>Statistics: Posted by Guest — Tue Oct 30, 2001 4:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-30T16:15:00-04:00</updated>

		<published>2001-10-30T16:15:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1223#p1223</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1223#p1223"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1223#p1223"><![CDATA[
Yes I read <a href="http://dev.scriptics.com/man/tcl8.3/TclCmd/read.htm" class="postlink">http://dev.scriptics.com/man/tcl8.3/TclCmd/read.htm</a><br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"><br>And I always do set $text "lala" <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":sad:" title="Sad"><br>stupid me<br><p>Statistics: Posted by Guest — Tue Oct 30, 2001 4:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2001-10-30T15:09:00-04:00</updated>

		<published>2001-10-30T15:09:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1221#p1221</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1221#p1221"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1221#p1221"><![CDATA[
You don't use the $ symbol in a set command.<br><br>Follow the links in one of my previous posts, it has a link for information on the read command, and tells you how to use it to read a certain amount of data.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Tue Oct 30, 2001 3:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-30T13:06:00-04:00</updated>

		<published>2001-10-30T13:06:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1220#p1220</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1220#p1220"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1220#p1220"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>while {$text != ""} {  set $text [read $sock]  msn:putchan "user" "$text"}</code></pre></div><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"><br>But the eggdrop is stoned when there is a connection <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":sad:" title="Sad"><p>Statistics: Posted by Guest — Tue Oct 30, 2001 1:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-30T12:18:00-04:00</updated>

		<published>2001-10-30T12:18:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1218#p1218</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1218#p1218"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1218#p1218"><![CDATA[
how can I make a while with read?<div class="codebox"><p>Code: </p><pre><code>[13:48] TCL error [test]: bad argument "text": should be "nonewline"</code></pre></div>someting is wrong <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":sad:" title="Sad"><p>Statistics: Posted by Guest — Tue Oct 30, 2001 12:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2001-10-30T11:41:00-04:00</updated>

		<published>2001-10-30T11:41:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1217#p1217</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1217#p1217"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1217#p1217"><![CDATA[
use the "read" command for this, you can pass it a length (in bytes) of how many chars you want to read.<br><br>Thus, if the command header tell you the message is 130 chars long, then you use the read command to read 130 bytes<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Tue Oct 30, 2001 11:41 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-30T11:31:00-04:00</updated>

		<published>2001-10-30T11:31:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1216#p1216</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1216#p1216"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1216#p1216"><![CDATA[
Thanks, But now my problem isn't gone <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":sad:" title="Sad"><br>the tcl sockets don't read msg from server whitout the crlf <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":sad:" title="Sad"><br>same problem as the eggdrop connect :'(<br><br>&lt;font size=-1&gt;[ This Message was edited by: Martin2k on 2001-10-30 08:34 ]&lt;/font&gt;<p>Statistics: Posted by Guest — Tue Oct 30, 2001 11:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2001-10-30T01:13:00-04:00</updated>

		<published>2001-10-30T01:13:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1202#p1202</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1202#p1202"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1202#p1202"><![CDATA[
Using gets isn't going to get you any farther than eggdrop sockets, because gets looks for a cr or lf. Read the msn protocol... there is a field that tells the length of the message. So, you need to parse the server message correctly, extract the length, then use the 'read' command, which lets you read an arbitrary number of bytes or characters (depending on the channel encoding).<br><br>Also, for the example you have, you shouldn't use the -async flag, because that creates an async socket, which means the socket is created, but not connected. You can't read any data from it until it is connected.<br><br>Ok, I just telnetted to the address you posted, and here is another problem with you sample code: the msn server doesn't send you anything until you've sent it something. If you send it the wrong thing, it just disconnects you.<br><br>Try this:<div class="codebox"><p>Code: </p><pre><code>set sock [socket messenger.hotmail.com 1863]puts $sock "USR 1 MD5 I you@hotmail.com"puts $sock "USR 1 MD5 S blah"flush $sockwhile {[gets $sock text] != -1} {  putlog "Server: $text"}putlog "Server closed connection"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Tue Oct 30, 2001 1:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2001-10-29T22:00:00-04:00</updated>

		<published>2001-10-29T22:00:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1194#p1194</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1194#p1194"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1194#p1194"><![CDATA[
It is likely that there is no data to read right after making the connection attempt.<br><br>It is best to use the "fileevent" command to setup a script to read the details, when somthing is received.<br><br>The "eof" command returns 1 or 0 - so eof will never equal "".<br><br>the if statment should be somthing like<blockquote class="uncited"><div>if {![eof $idx]} {</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Mon Oct 29, 2001 10:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-29T21:37:00-04:00</updated>

		<published>2001-10-29T21:37:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1193#p1193</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1193#p1193"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1193#p1193"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set idx [socket -async messenger.hotmail.com 1863]while {[eof $idx] != ""} {set data [gets $idx]putlog "msn: $data"}}</code></pre></div>is that the best way to do that?<br>or not? (I don't know if it works <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"> )<p>Statistics: Posted by Guest — Mon Oct 29, 2001 9:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2001-10-29T21:18:00-04:00</updated>

		<published>2001-10-29T21:18:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1192#p1192</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1192#p1192"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1192#p1192"><![CDATA[
Eggdrops scripted sockets, or TCL sockets are the only way.<br><br>Eggdrop sockets have proven to be incompatible with this system, and TCL sockets are not giving you any luck.<br><br>The only other option, is to use a help application.<br><br>Where your TCL script calls a third-party program using the "exec" command, and the the returned value is used for message grabbing.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Mon Oct 29, 2001 9:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-29T21:06:00-04:00</updated>

		<published>2001-10-29T21:06:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1191#p1191</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1191#p1191"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1191#p1191"><![CDATA[
but when there is no connection he give's a tcl error <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":sad:" title="Sad"><br>[23:04] TCL error [test]: can not find channel named "sock1688"<br><br>I can't use that in my script I think, is there no better way?<p>Statistics: Posted by Guest — Mon Oct 29, 2001 9:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2001-10-29T20:04:00-04:00</updated>

		<published>2001-10-29T20:04:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1188#p1188</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1188#p1188"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1188#p1188"><![CDATA[
The 'eof' command lets you know when the socket is closed.<br><br>Browse through the tcl commands like ppslim said, it tells you all the stuff you need to know <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Mon Oct 29, 2001 8:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-29T13:36:00-04:00</updated>

		<published>2001-10-29T13:36:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=1175#p1175</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=1175#p1175"/>
		<title type="html"><![CDATA[help with sock connections]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=1175#p1175"><![CDATA[
A thanks, But how can I check of sock is open or close?<p>Statistics: Posted by Guest — Mon Oct 29, 2001 1:36 pm</p><hr />
]]></content>
	</entry>
	</feed>
