Posted 15 March 2012 - 12:15 AM
Well, I decided to make the Internet. Client/Server style. I use modems and the modems are on the right side.
I made a flie on the server comp called derp.txt and it has:
What I typed:
Error:
Client program:
Server program:
I DONT KNOW WHAT I DID WRONG
I made a flie on the server comp called derp.txt and it has:
Spoiler
herp
derp
Spoiler
Server computer:
server
Client computer
client 1 derp
Spoiler
No error in server.
Client error:
client:18: attempt to index ? (a nil value)
Spoiler
local tArgs = {...}
sCId = tArgs[1]
nPage = tArgs[2]
function c()
term.clear()
term.setCursorPos(1,1)
end
if #tArgs ~= 2 then
error("Usage: client <SCid> <page/list>")
else
c()
rednet.open("right")
CId = tonumber(sCID)
rednet.send(CId, nPage)
print("Connecting...")
id, message = redent.recieve(5)
c()
if message == nil then
print("Connection Error")
end
print(message)
end
Spoiler
local tArgs = {...}
sCId = tArgs[1]
nPage = tArgs[2]
function c()
term.clear()
term.setCursorPos(1,1)
end
rednet.open("right")
function mm()
while true do
local event, sId, message = os.pullEvent()
if event == "rednet_message" then
id = tonumber(sId)
fs = io.open("/server/"..message..".txt", "r")
page = fs:read("*a")
fs:close()
rednet.send(id, page)
end
end
end
mm()