TL;DR
UDP Writes - enabling easier Telemetry output from FactorioWhat ?
Right now, we can write output to file with game.write_file, but we cannot output to ports or sockets.If we could write to a port with game.udp_write(port, data) then we could fire-and-forget write to network sockets, perhaps (definitely?) limited to localhost ports.
Why ?
Ultimately, my goal is to write Open Telemetry Metrics, Traces, and Logs from Factorio. Doing this right now requires some hacking around with the file API, similar to this attempt here: https://medium.com/expected-behavior/in ... 5d63fecdd0 ,Their solution is to write to a file every X seconds, then have another process read-and-delete those files. This feels fragile, especially if it's not clear whether the file being written to has been flushed.
It would be much more elegant if we were able to write UDP to a socket. This could (should) be a high numbered port to avoid needing administrative priviledges.
But doesn't that make it non-deterministic?
Not if we send as fire-and-forget and don't need any acknowledgement, it's be similar to writing to a file. There would be no need (or capability?) for factorio to recieve UDP packets. It would just need to be able to write to a (provided? fixed?) high numbered localhost port.We could then have all the transformation to the opentelemetry standard done on the reciever side of those packets.