[racket-users] Re: set a timeout to tcp-connect

2015-07-17 Thread mazert
Le 17/07/2015 17:06, George Neuner a écrit : Won't the connection attempt eventually time out and cause an exception when the TCP stack closes the socket? I know the default connect timeout is rather long though (150 seconds?). Yes it will close for sure but after a long time (maybe 150 sec as

[racket-users] Re: set a timeout to tcp-connect

2015-07-17 Thread mazert
Le 17/07/2015 17:08, Matthew Flatt a écrit : It's possible (but unlikely) for the thread bound to `a` to complete and try to kill `b` before the variable `b` is initialized. Ah ok, yes that is risky in this case, plus we didn't close the tcp connection. Here's what I'd do: * Create a cust

Re: [racket-users] Re: set a timeout to tcp-connect

2015-07-17 Thread Matthew Flatt
At Fri, 17 Jul 2015 16:58:50 +0200, mazert wrote: > Le 17/07/2015 16:16, Matthias Felleisen a écrit : > > This actually works. But I am not sure why you'd want to do something like > that. > > Ah yes, letrec is what I was looking for :) . The goal was to test a > port with a specific timeout (he

Re: [racket-users] set a timeout to tcp-connect

2015-07-17 Thread George Neuner
On 7/17/2015 10:16 AM, Matthias Felleisen wrote: On Jul 17, 2015, at 9:31 AM, mazert wrote: > #lang racket > > (define (foo) > (let* ([a (thread (λ () > (let-values ([(p-in p-out) (tcp-connect "google.com" 80)]) > (kill-thread b] > [b (thread (λ () > (sleep 2) > (printf "I'll kill you !")

[racket-users] Re: set a timeout to tcp-connect

2015-07-17 Thread mazert
Le 17/07/2015 16:16, Matthias Felleisen a écrit : This actually works. But I am not sure why you'd want to do something like that. Ah yes, letrec is what I was looking for :) . The goal was to test a port with a specific timeout (here I set it to two for dev purposes, but 10 is better). I rew

Re: [racket-users] Problem when using horizontal pane

2015-07-17 Thread Mianlai Zhou
Yes, this is exactly what I want. Thank you a lot. -- Mianlai On Fri, Jul 17, 2015 at 4:36 PM, Matthew Flatt wrote: > At Fri, 17 Jul 2015 15:16:34 +0800, Mianlai Zhou wrote: > > I have the following code: > > > > #lang racket > > > > (require slideshow racket/class racket/gui/base) > > > > (def

Re: [racket-users] set a timeout to tcp-connect

2015-07-17 Thread Matthias Felleisen
On Jul 17, 2015, at 9:31 AM, mazert wrote: > #lang racket > > (define (foo) > (let* ([a (thread (λ () > (let-values ([(p-in p-out) (tcp-connect "google.com" > 80)]) >(kill-thread b] > [b (thread (λ () > (sleep 2) >

[racket-users] set a timeout to tcp-connect

2015-07-17 Thread mazert
Hello, When i try to connect on smtp.google.com on port 587 (submission) through tcp-connect, it works perfectly ; but if instead of 587 i put 666 (for example) it stucks cause the server dont answer. So after reading fews hours the doc, I didn't found a native solution to implement this, so

Re: [racket-users] Problem when using horizontal pane

2015-07-17 Thread Matthew Flatt
At Fri, 17 Jul 2015 15:16:34 +0800, Mianlai Zhou wrote: > I have the following code: > > #lang racket > > (require slideshow racket/class racket/gui/base) > > (define my-frame (new frame% [label "My chess"] > [width 300] [height 391] >

[racket-users] Problem when using horizontal pane

2015-07-17 Thread Mianlai Zhou
Hi all, I have the following code: #lang racket (require slideshow racket/class racket/gui/base) (define my-frame (new frame% [label "My chess"] [width 300] [height 391] [alignment '(center center)] )) (define my-canvas