help from Dixon or others about port
[1/5] from: g:santilli:tiscalinet:it at: 7-Sep-2001 15:54
Hello Romano!
On 06-Set-01, you wrote:
RT> I do not understand the last command:
RT> in: first l
RT> and why does it make a wait before?
The wait is not necessary in this case. L is a listen port (in
this case, it is not bound to a fixed port id, but the OS assigns
one to it which is then accessed with L/PORT-ID); it does not
receive data, but connections. So it returns connections, in the
form of ports.
listen: open tcp://:80 ; listen on port 80
connection: first listen
If you do the above and then point your web browser to localhost,
you'll get in CONNECTION the connection with the browser. LISTEN
can receive any number of connections (the OS poses limits as to
how many of them can be queued before they get "answered") and you
can get the next one with FIRST LISTEN or PICK LISTEN 1. This
operation is always blocking, and waits until a connection comes.
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[2/5] from: rotenca:telvia:it at: 7-Sep-2001 18:57
Thank you, always more than perfect your answers.
Do you know if someone has written a console emulator, which we can put in
system/output instead of default port?
Or some code to adapt?
Do you know what settings require a port-handler-protocol-scheme for console?
(a little question :-))
---
Ciao (my english is bad)
Romano
[3/5] 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:
first l
> 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
'L
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?
wait l
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
[4/5] from: lmecir:mbox:vol:cz at: 7-Sep-2001 10:03
Hi Romano,
> I've found in rem42.r this line of code:
>
> l: open tcp://: out: open join tcp://localhost: l/port-id wait l in:
first l
> I do not understand the last command:
> in: first l
<<quoted lines omitted: 4>>
> Ciao (my english is bad)
> Romano
1) The L port opened with (open tcp://:) is a listen (or server) port. Its
function is to provide ports to clients that are trying to connect. To be
able to speak to the specific client you must get a port to that client from
the listen port.
2) The Out port is a client port trying to connect to the server.
3) The In port is a port that the server- (or listen-) port provides as a
reaction to the client attempt to connect. Wait is there, because the server
must establish the connection to the client before it can provide a port.
HTH
[5/5] from: rotenca:telvia:it at: 6-Sep-2001 18:16
I've found in rem42.r this line of code:
l: open tcp://: out: open join tcp://localhost: l/port-id wait l in: first l
I do not understand the last command:
in: first l
and why does it make a wait before?
The command "first port" doesn't give the data in input?
Why here does it give a pointer to port?
---
Ciao (my english is bad)
Romano
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted