Connect to a leto instance¶
- fort-hermes provides utility to connect to a live leto
instance. Usually those broadcast live tracking data on TCP port 4002. Those broadcast can be accessed with
fort::hermes::FileContext
orpy_fort_hermes.network.connect()
C++¶
#include <fort/hermes/NetworkContext.hpp>
NetworkContext context("host",4002,true);
// Like for FileContext, we re-use the same FrameReadout through the loop;
FrameReadout ro;
while (true) {
try {
context.Read(&ro);
} catch ( const fort::Hermes::WouldBlock &) {
//No message ready yet
}
}
Python¶
import py_fort_hermes as fh
with fh.network.connect("host") as c:
try:
ro = next(c)
except StopIteration:
break