lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Two suggestions.

1 - take a look at how nmap does this stuff, its recently integrated
lua for i/o, it has plugins that can interact with the network, you
might not be able to use the code, but you might find ideas from it's
APIs

2 - don't burden your control experts with tcp/ip network knowledge,
model communication as something closer to event-driven i/o.

for a/d inputs, you have a value-changed event, which causes a
function to be called

so, maybe allow something like:

  addTcp{error=..., connected=..., dataAvail=...., writeReady=...}

where ... are functions. they'll get callbacks, and they can do things
like get a current input value and write it

I'm not to sure luasocket will really help you. You can use copas or
something on top, but copas is to allow people to write code that
looks linear, when its actually event-driven.

Your users already have to deal with an event-driven system, you don't
have to hide it from them.

Also, for things like SNMP and DNS lookups, there are lots of
asynchronous and high-quality C libs to to that kind of thing, you'll
probably find it easier to integrate C libs and provide nice
high-level APIs that are event-driven, with idioms common to the set
of capabilities you offer your control engineers.

My two bits.

Cheers,
Sam