4 posts
Posted 17 June 2014 - 09:11 AM
After seeing so many tutorials on how to make simple chat systems with RedNet and eventually made a simple chat system with RedNet that works for me, but then I was wondering if there is anyway to log every single RedNet activity? If anyone knows could you give me some tips or examples on how to make one?
7083 posts
Location
Tasmania (AU)
Posted 17 June 2014 - 10:08 AM
"In the area" or "on the system"?
Which version of ComputerCraft?
4 posts
Posted 17 June 2014 - 10:50 AM
"In the area" or "on the system"?
Which version of ComputerCraft?
Well I am looking for a way to make a logger which can receive when something happens over RedNet kinda like a DDnS, and it should be able to locate it "in the area" if by in the area you mean it gives information from other clients and then receives it to its own system.
Also I am trying to make it on CC v1.5
7083 posts
Location
Tasmania (AU)
Posted 17 June 2014 - 12:06 PM
Under that build, the only practical method of going about it is to have everything you want logged sent to the logging system.
You could do this by using rednet.broadcast() to transmit everything (as this sends everything to everyone), though I'd be inclined to write a wrapper for rednet.send() which passes on a copy of all messages to the logger specifically. Eg:
local function transmit(id, message)
rednet.send(id, message)
rednet.send(loggerId, {id, message})
end
Your computers would then use transmit() instead of rednet.send(), and your logging system would get a copy of all messages which it could then record.
12 posts
Location
Wesley Chapel, FL
Posted 18 June 2014 - 10:10 PM
I might suggest using a "middle computer"/"bridge".
Using a computer, pop it down within range of all the wireless computers or the wired network. Have every computer connect to that computer and then have that computer send the request to the respective id. On the central computer setup a file, and have the chat append to the file. Therefore logging the file. If you need the file to be secure, I suggest adding a prefix "
." to the file.
Physical Example: [Computer] ——> [<—BridgeComputer—–>] <——-[Computer]OR
You can always have each computer store the text while it comes in, also using the filing system.
For the file system see the
wiki on computercraft on the API subject fs.
I also have a few programs I have already written using something very similar. I use mine to log door functions(open/close), connections and more.
Here is my
pastebin if you need examples:
Cavious's Pastebin:
http://pastebin.com/u/CaviousLogging Example:
http://pastebin.com/KMGrJY5zJust make sure you use "
a" for append, and not "
w" for write, otherwise you'll write over your existing log/line.
Good Luck,
Donald R. Valverde (Cavious)