Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Problem with try [ open/direct/binary tcp://... ] Re:

From: petr:krenzelok:trz:cz at: 2-Oct-2000 21:37

----- Original Message ----- From: <[eventi--nyic--com]> To: <[list--rebol--com]> Sent: Monday, October 02, 2000 9:16 PM Subject: [REBOL] Problem with try [ open/direct/binary tcp://... ]
> ;; This fails whenever the host's gone away (OFTEN!!) > > ;; ** Access Error: Cannot connect to 127.10.176.206. > ;; ** Where: Open/direct/binary probe To-url join "tcp://" > > ;; Isn't try supposed to catch and handle this? If not, how else could I
;;
> do it? > > Connect: Func [ ip port ] [ > Gp: try [ > Open/direct/binary probe To-url join "tcp://" [ Ip ":" port ] > ] > if not error? gp [ > insert gp "GNUTELLA CONNECT/0.4^/^/"
that's wrong btw. You've just assigned 'gp to the result of try, which in turn can be error object. What about: if not error? try [gp: open/direct/binary probe join tcp:// [ip ":" port]] [insert gp "GNUTELLA CONNECT/0.4^/^/"] note - join knows how to work with datatypes - provide first argument as url! and it will convert rest for you ... see my code ... Cheers, -pekr-