[racket-dev] Implementation question

From: Laurent (laurent.orseau at gmail.com)
Date: Sat Apr 19 08:34:09 EDT 2014

One simpler possibility is to use `tcp-connect/enable-break` and run a
timer in parallel to break it after a shorter delay.
For example:

(define-values (in out) (values #f #f))

(define connect-thread
   (λ()(set!-values (in out)
                    (tcp-connect "www.google.com" 80)))))

(sleep 3)
(unless in
  (displayln "Connection not established. Breaking thread.")
  (break-thread connect-thread))

The timer can also be place into its own thread if you need to set up
several connections in parallel.

Hope this helps,

On Thu, Apr 17, 2014 at 6:48 PM, nicolas carraggi
<nicocarraggi at hotmail.com>wrote:

> Hello,
> I am actually using "Racket/tcp" for a project in Racket.
> I'm creating a peer-to-peer network but now I encountered a small problem.
> For a multicast I want to connect with each server on the same network.
> For this I use "tcp-connect", but when i try to connect to an ip address
> which is not hosting a server, throwing the error only happens after more
> than 1 minute. So I would like to use a modified "tcp-connect" with a
> smaller time-out.
> Where can I find the implementation of "tcp-connect"?
> I already found "tcp.rkt" but there it gets the "tcp-connect" method from
> "'#%network" but I can't find this one...
> Greetings!
> Nicolas
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20140419/8038a7cc/attachment-0001.html>

Posted on the dev mailing list.