Ah! This must be it I think. The simple test only call the agent once,
the real code is calling repeatedly so only the first call to eval>
works and then I get the error.

Thanks for that one! A vestige from copy paste action earlier (your
code was closing/opening repeatedly I think), the most bug generating
behavior I know of (but oh so tempting).



On Tue, Feb 9, 2010 at 7:43 AM, Alexander Burger <a...@software-lab.de> wrot=
e:
> Hi Henrik,
>
>> This is strange, when I test with simple data, for example:
>>
>> (setq Lst '((4 5 6) (7 8 9)))
>> (println (eval> '+Agent 1 'setArticleWords (lit Lst)))
>>
>> Then everything works just fine, the data is stored properly and I get
>> proper return values.
>>
>> Then when I run the real code I just breaks down:
>>
>> [import_feeds.l:7] !? (out Sock (pr (rest)))
>> 5 -- Bad FD
>
> It looks like the socket was closed.
>
>
>> (class +Agent)
>>
>> (dm connect> (SockNum)
>> =A0 =A0(connect "localhost" (+ 4040 SockNum)))
>>
>> (dm sock> (A)
>> =A0 =A0(let SockNum (if (num? A) A (max 1 (/ (; A aid) 10000)))
>> =A0 =A0 =A0 (or
>> =A0 =A0 =A0 =A0 =A0(: sock)
>> =A0 =A0 =A0 =A0 =A0(=3D: sock
>> =A0 =A0 =A0 =A0 =A0 =A0 (let Sock (connect> This SockNum)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(if Sock
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Sock
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (call "sh" "-c"
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(pack "./p projects/rss-reade=
r/word_index.l -go "
>> SockNum " -wait >> index.log 2>&1 &"))
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (connect> This SockNum)))))))
>>
>> (dm eval> (A . @)
>> =A0 =A0(let? Sock (sock> This A)
>> =A0 =A0 =A0 (out Sock (pr (rest)))
>> =A0 =A0 =A0 (prog1 (in Sock (rd))
>> =A0 =A0 =A0 =A0 =A0(close Sock))))
>
> The problem is that this works only once, because the socket is closed
> after the first call to 'eval>'. The next call to 'sock>', however, will
> return the 'sock' property of the agent.
>
>
> Is it necessary to close the socket here? After all, you preserve the
> socket in the agent. Otherwise, if you close the socket later, it would
> be better to record this also in the agent:
>
> =A0 =A0 =A0(prog1 (in Sock (rd))
> =A0 =A0 =A0 =A0 (close Sock)
> =A0 =A0 =A0 =A0 (=3D: sock NIL) )
>
> Cheers,
> - Alex
> --
> UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe
>
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to