Posted 30 November 2013 - 11:35 PM
I have developed a small set of scripts to enable wireless access of any computercraft peripherals. These scripts are mainly for my own use, but I thought others might be interested so I posted them.
Prerequisites
You must have an operational installation and functioning network using Lyqyd's LyqydNet API.
http://www.computerc...net-rednet-api/
Programs/APIs
[indent=2]You will note that nets.send() allows multiple additional arguments. This allows the building of more complicated requests and responses. The api will also automatically return multiple results from functions calls from across the network.[/indent]
[indent=2]http://pastebin.com/4tctWiT8[/indent]
[indent=2]To Do: I need to wrap up the listen function for foreground servers. I haven't had a need for this yet, but I will get to it eventually.[/indent]
[indent=2]This should work with any type of peripheral. I've tested quite a few but not all existing peripherals.[/indent]
[indent=2]http://pastebin.com/APNEz5BY[/indent]
[indent=2]To Do: I've been playing around with the connection management. In past versions I've opened and closed connections for every transaction, but that seemed wasteful. I've got a somewhat sloppy start to a connection pooling system going on now, but I'm not noticing any significant benefit in terms of network performance. More testing is definitely needed, consider this a work in progress.[/indent]
[indent=2]http://pastebin.com/XhaDnyZ8[/indent]
[indent=2]To Do: Connection management related to nperi is all I'm planning here. This seems to work pretty well so far.[/indent]
[indent=2]http://pastebin.com/auun2B4E[/indent]
Other Resources
You can find more examples and my current working scripts here:
https://github.com/T...inum/Wintermute
Other Remarks
This is all a work in progress, so I am sure there are some rough parts. This is also my first Lua or ComputerCraft project so please be kind. That being said any constructive suggestions and feedback are welcomed.
Prerequisites
You must have an operational installation and functioning network using Lyqyd's LyqydNet API.
http://www.computerc...net-rednet-api/
Programs/APIs
- nets - network serialization API
[indent=2]You will note that nets.send() allows multiple additional arguments. This allows the building of more complicated requests and responses. The api will also automatically return multiple results from functions calls from across the network.[/indent]
[indent=2]http://pastebin.com/4tctWiT8[/indent]
[indent=2]To Do: I need to wrap up the listen function for foreground servers. I haven't had a need for this yet, but I will get to it eventually.[/indent]
- nperi - network peripheral API
[indent=2]This should work with any type of peripheral. I've tested quite a few but not all existing peripherals.[/indent]
[indent=2]http://pastebin.com/APNEz5BY[/indent]
[indent=2]To Do: I've been playing around with the connection management. In past versions I've opened and closed connections for every transaction, but that seemed wasteful. I've got a somewhat sloppy start to a connection pooling system going on now, but I'm not noticing any significant benefit in terms of network performance. More testing is definitely needed, consider this a work in progress.[/indent]
- nperid - network peripheral server daemon
[indent=2]http://pastebin.com/XhaDnyZ8[/indent]
[indent=2]To Do: Connection management related to nperi is all I'm planning here. This seems to work pretty well so far.[/indent]
- test - nperi test program
[indent=2]http://pastebin.com/auun2B4E[/indent]
Other Resources
You can find more examples and my current working scripts here:
https://github.com/T...inum/Wintermute
Other Remarks
This is all a work in progress, so I am sure there are some rough parts. This is also my first Lua or ComputerCraft project so please be kind. That being said any constructive suggestions and feedback are welcomed.
Edited on 02 December 2013 - 05:33 PM