UDP packets on chest listener

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
gamecompiler
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Jul 11, 2019 12:17 pm

UDP packets on chest listener

Post by gamecompiler »

Hi :ugeek:,

i guess theres a way to create for example a "chest listener", are there any ways to create a udp socket from inside the mod?
I would like to implement a chest listener that broadcasts its inventory via udp..

I never used to code in Lua, im more familiar with Java. If my goal is not possible i would actually throw away my idea - would not involve much time into it.
Did someone tried to archive this or know if theres a udp interface?

Ive got some old dot matrix displays next to me. Wouldnt it be fun to use those to display production statistics?

With kind regards, gamecompiler
Perfectly synchronized.

mrvn
Smart Inserter
Smart Inserter
Posts: 5682
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: UDP packets on chest listener

Post by mrvn »

check out the clusterio mod

gamecompiler
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Jul 11, 2019 12:17 pm

Re: UDP packets on chest listener

Post by gamecompiler »

Thank you very much for your answer :)

Its not really what i am searching for (but nice mod!). The mod writes its data to a file, a "back" - backend from outside the game - then parses the data and serves it.
That is one way to get it done. But it would be a way better if factorio it self will archive this.

If there is no other possibility i actually will do it like Clusterio. I am searching currently for ways to do it. It seems that UDP is not supported - but maybe i am missing something.

Maybe i am wrong, the read/write operation of the clusterio mod must/should be synchronized. Otherwise a race condition will happen. I am not sure if the os will secure this.
Perfectly synchronized.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: UDP packets on chest listener

Post by eradicator »

gamecompiler wrote:
Thu Jul 11, 2019 5:01 pm
That is one way to get it done.
That is the *only* way to get it done. Mods are not allowed to read any data from the "outside world".
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: UDP packets on chest listener

Post by slippycheeze »

gamecompiler wrote:
Thu Jul 11, 2019 12:33 pm
i guess theres a way to create for example a "chest listener", are there any ways to create a udp socket from inside the mod?
There is not, no. Your mental model is wildly far from the reality of the situation, I'm afraid. I can see how you came by it, but the way it works in practice is radically different from any sort of network interface inside the game.

User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 2420
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: UDP packets on chest listener

Post by BlueTemplar »

While probably limited to stay inside the game for now, this feels relevant to the discussion :
Feathernet: Autoconfigured Native and IPv6 Networking over Factorio Circuit Networks
BobDiggity (mod-scenario-pack)

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: UDP packets on chest listener

Post by slippycheeze »

BlueTemplar wrote:
Fri Jul 12, 2019 3:05 pm
While probably limited to stay inside the game for now, this feels relevant to the discussion :
Feathernet: Autoconfigured Native and IPv6 Networking over Factorio Circuit Networks
Nah, the author mentioned they implemented a (custom) ClusterIO server protocol wrapper to provide a GRE tunnel to their router, so Factorio was on the IPv6 Internet. ...or at least adjacent to it. Given support for publicly routable addresses, though....

Post Reply

Return to “Modding discussion”