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: g:santilli:tiscalinet:it at: 3-Oct-2000 9:35

[eventi--nyic--com] wrote:
> 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^/^/" > print to-string data: copy gp > ] > return gp > ]
You need to write it this way: Connect: Func [ ip port ] [ either not error? Gp: try [ Open/direct/binary probe To-url join "tcp://" [ Ip : port ] ] [ insert gp "GNUTELLA CONNECT/0.4^/^/" print to-string data: copy gp gp ] [ disarm gp ] ] (You'll get an object as result if there was an error; I think this is what you intended with the code above. Notice that you cannot return an error without disarming it into an object.) HTH, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/