You can obtain that information by calling QUERY on the client port!
, which will return an object with remote-ip
and remote-port
fields.
Here's a simple example illustrating this, with a simple service that listens for connections on port 9090 and prints the address of clients connecting to that service:
rebol []
awake-server: func [event /local client info] [
if event/type = 'accept [
client: first event/port
info: query client
print ajoin ["Client connected: " info/remote-ip ":" info/remote-port]
close client
]
]
serve: func [endpoint /local listen-port] [
listen-port: open endpoint
listen-port/awake: :awake-server
wait listen-port
]
serve tcp://:9090