not sure what you've got going on here but here is are basic server/client scripts
the client code:
rednet.open("top")
print("Looking for a server...")
while ID == nil do
rednet.announce() --sends an empty rednet message so server can get its ID
ID, message, distance = rednet.receive(5) --5 is the timeout in seconds
end
print("Server replied!")
print("ID: "..ID)
print("Message: "..message)
print("distance: "..distance)
rednet.send(ID, "Found you!") --To send a message back to the server
rs.setOutput("back", true) --Or to change the redstone state of a side
the server code:
rednet.open("top") -- parameter is the side with the modem
while true do
print("Waiting for a client...")
ID, message, distance = rednet.receive() --no parameter means wait forever
if ID ~= nil then --nil ID might be returned if you have a timeout on rednet.receive()
print("Found a client!")
print("ID: "..ID)
print("Message: "..message)
print("distance: "..distance)
rednet.send(ID, "Hello") --To send a message back to the client
end
end
I hope this helps