UDP Networking (fwd)
[1/6] from: list::brando::rebol::net at: 19-Oct-2000 2:31
---------- Forwarded message ----------
Date: Thu, 19 Oct 2000 09:36:41 +0200 (DFT)
From: Frank Sievertsen <[fsievert--uos--de]>
To: [list--rebol--com]
Subject: UDP Networking
Hi!
Having an udp-server
s: open udp://
and receiving a message
copy/part s 1
== "Blubb"
How to find out, from which ip and port the message has been send?
I know I can answer to the client, but I need to find out on which port/ip
it lives. This feature is needed since udp often works this way.
Having a server.
- Incoming message.
- Opening new port
- Answering the messages with the new port
- All further communication is done by the new port, while the server
port only receives the first messages from each client.
Frank
[2/6] from: holger:rebol at: 19-Oct-2000 5:57
On Thu, Oct 19, 2000 at 02:31:02AM -0700, [list--brando--rebol--net] wrote:
> Hi!
> Having an udp-server
<<quoted lines omitted: 5>>
> I know I can answer to the client, but I need to find out on which port/ip
> it lives. This feature is needed since udp often works this way.
With current experimental versions you can read the IP/port combination
from s/remote-ip and s/remote-port, after reading the message.
--
Holger Kruse
[holger--rebol--com]
[3/6] from: philip:hayes:btcellnet at: 19-Oct-2000 14:16
Holger,
I'm running 2.4.37.10.1 on Solaris 2.6
when I run this ...
#####
buffer: make string! 1000
listen-port: open/binary/direct udp://:9999
forever [
wait listen-port
read-io listen-port buffer 1000
print buffer
print listen-port/remote-ip
clear buffer
]
####
I get ....
#####
Hello, world
none
#####
Phil
[4/6] from: holger:rebol at: 19-Oct-2000 7:14
On Thu, Oct 19, 2000 at 02:16:25PM +0100, Hayes Philip wrote:
> Holger,
> I'm running 2.4.37.10.1 on Solaris 2.6
<<quoted lines omitted: 5>>
> wait listen-port
> read-io listen-port buffer 1000
Use copy, not read-io.
--
Holger Kruse
[holger--rebol--com]
[5/6] from: philip:hayes:btcellnet at: 19-Oct-2000 15:55
Why ?
[6/6] from: holger:rebol at: 19-Oct-2000 8:39
On Thu, Oct 19, 2000 at 03:55:17PM +0100, Hayes Philip wrote:
> Why ?
read-io is not intended to be used with UDP. It is a low-level function that was
added to REBOL only for use by REBOL's internal protocol implementations (HTTP
etc.). It bypasses a lot of useful code, including, in the case of UDP, the code
that retrieves the peer's IP address and port number and places them into the
port object.
> On Thu, Oct 19, 2000 at 02:16:25PM +0100, Hayes Philip wrote:
> > Holger,
<<quoted lines omitted: 9>>
> > read-io listen-port buffer 1000
> Use copy, not read-io.
--
Holger Kruse
[holger--rebol--com]
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted