chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] chicken-install from behind a proxy


From: Paul Romanchenko
Subject: Re: [Chicken-users] chicken-install from behind a proxy
Date: Sun, 25 Apr 2010 14:04:05 +0400

Please, check the patch for tcp.scm.
It adds peek function for tcp ports.
I'm so familiar with chicken internals, so, please, check this patch thoroughly.

$ diff tcp.scm ../../paul/work/chicken-core/tcp.scm
411,416c411
<              (lambda ()
<                (when (fx>= bufindex buflen)
<                  (read-input))
<                (if (fx< bufindex buflen)
<                  (##core#inline "C_subchar" buf bufindex)
<                  #!eof))
---
>              #f


On Fri, Apr 23, 2010 at 4:41 PM, Felix
<address@hidden> wrote:
> From: Paul Romanchenko <address@hidden>
> Subject: Re: [Chicken-users] chicken-install from behind a proxy
> Date: Fri, 23 Apr 2010 12:32:44 +0400
>
>> I think this can be related:
>>
>> I have a file with 2 digits:
>>
>> $ od -c /tmp/xy
>> 0000000   1  \n   2  \n
>> 0000004
>>
>> Also I have a simple tcp server which echoed the same 2 digits then
>> closes connection:
>> $ netcat localhost 9999 | od -c
>> 0000000   1  \n   2  \n
>> 0000004
>>
>> Let's make a function which reads number, CR, number from given input port:
>> (define (test i)
>>   (with-input-from-port i
>>     (lambda () (printf "~a~a~a~%" (read) (read-line) (read)))))
>>
>> And test it against file and server:
>> (let-values (((i o) (tcp-connect "localhost" 9999)))
>>   (test i)
>>   (test (open-input-file "/tmp/xy")))
>>
>> $ csi cln.scm
>>
>> CHICKEN
>> (c)2008-2010 The Chicken Team
>> (c)2000-2007 Felix L. Winkelmann
>> Version 4.4.6
>> linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
>> compiled 2010-04-16 on gladstone.duckburg.org (Linux)
>>
>> ; loading cln.scm ...
>> ; loading library tcp ...
>> 12#!eof
>> 12
>> #;1>
>>
>> Different results.
>>
>
> You found it. Apparently the input functions for tcp-ports
> ignore a peek'd and unread character. Damn.
>
> Thanks a lot for your help!
>
>
> cheers,
> felix
>



-- 
rmrfchik.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]