[REBOL] Re: help from Dixon or others about port
From: deadzaphod::flyingparty::com at: 6-Sep-2001 22:42
> I've found in rem42.r this line of code:
Wow, I didn't think anyone still looked at that... There was never much
enthusiasm about the text-editor with no line-wrap or mouse... ;-)
> l: open tcp://: out: open join tcp://localhost: l/port-id wait l in:
> I do not understand the last command:
> in: first l
first, break it apart (there's a lot going on in that one line):
l: open tcp://
this opens a listen port on any available TCP port number and assigns it to
out: open join tcp://localhost: l/port-id
this opens a connection to the port opened as 'L and assigns it to 'OUT
> and why does it make a wait before?
this ensures that the connection attempt has actually reached 'L ,
everything would probably still work without it, but I'm not sure... I
haven't looked at this in a while now.
> The command "first port" doesn't give the data in input?
> Why here does it give a pointer to port?
in: first l
using 'FIRST on a listen port retrieves an open port object (a connection).
This allows accepting several connections to the same port, without having
to reopen the listen port each time - The receiving end of all TCP
connections works this way. So now one end of the connection is assigned to
'OUT and the other end is assigned to 'IN .
- Cal Dixon