Transport Addresses
Address forms accepted by RLMesh clients and servers, and what an address does and does not mean.
Clients and servers meet at an address. The same address string formats work on both sides: the server binds to one, the client connects to one.
Most examples use plain TCP host:port:
from rlmesh.numpy import RemoteEnv
env = RemoteEnv("127.0.0.1:5555")
The explicit scheme form is also accepted and means the same thing:
RemoteEnv("tcp://127.0.0.1:5555")
Server binding
EnvServer accepts an address string or keyword helpers:
server = rlmesh.EnvServer(env, "127.0.0.1:5555")
server = rlmesh.EnvServer(env, host="127.0.0.1", port=5555)
server = rlmesh.EnvServer(env, host="127.0.0.1", port=0)
Use port=0 to ask the OS for an available port, which avoids
collisions in tests and parallel runs. Read the resolved address back
after start():
server.start()
print(server.address)
Hand that resolved address to clients; do not assume the port you asked
for when you asked for 0.
Unix sockets
For processes on the same host, a filesystem socket can be more
convenient than picking a TCP port. Use the unix:// scheme with a
socket path:
server = rlmesh.EnvServer(env, "unix:///tmp/rlmesh-env.sock")
remote = RemoteEnv("unix:///tmp/rlmesh-env.sock")
The server can also take the path as a keyword:
rlmesh.EnvServer(env, path="/tmp/rlmesh-env.sock")
Unix sockets sidestep port management, at the cost of being local-only.
Address forms at a glance
| Form | Example | Notes |
|---|---|---|
| Host:port | 127.0.0.1:5555 |
Shorthand for TCP. |
| TCP scheme | tcp://127.0.0.1:5555 |
Explicit form of the above. |
| OS-assigned port | host="127.0.0.1", port=0 |
Read back with server.address. |
| Unix socket | unix:///tmp/rlmesh-env.sock |
Same-host processes only. |
Addresses are not ownership
An address tells a client where to connect; it does not grant ownership of the endpoint behind it. See Runtime Lifecycle for who is responsible for shutting a server down.