3 posts
Posted 13 January 2013 - 04:16 AM
Hello
I made a programm that requests the gps position from an other computer and returns the data to the first computer. Both terminals are advanced computers, the first request works, but the return message dont works and returns as message "PING". The funny thing is that the same programm works between two normal computers and between an advanced and an normal computer, but not between two advanced computers.
Maybe somebody have the same problem.
997 posts
Location
Wellington, New Zealand
Posted 13 January 2013 - 07:17 PM
Upload your code to
http://pastebin.com/ and post the link here.
8543 posts
Posted 13 January 2013 - 09:22 PM
Moved to Ask a Pro. If it becomes clear that there really IS an issue (which I haven't seen in my testing), I'll move this back. We'll need to see the code.
3 posts
Posted 18 January 2013 - 07:46 AM
Hello
I tried to figure it out why it wont work but i did'nt find it.
Here are the programms of the two computers, it's funny because in the previous version i made a programm simmilar to this and it works. I allready simplified this to bugfix it but i think i derpt it up. if you have an idea please post it.
Sender:
rednet.open("right")
rednet.send(15, "locate", true)
event, id, msg, dst = os.pullEvent("rednet_message")
print(id)
print(msg)
print(dst)
umsg = textutils.unserialize(msg)
print(tostring(umsg[1]))
print(umsg[2])
print(umsg[3])
print(umsg[4])
Receiver:
rednet.open("right")
function locate()
co1, co2, co3 = gps.locate(2)
x = tonumber(co1)
y = tonumber(co3)
z = tonumber(co2)
print(x)
print(y)
print(z)
end
while true do
err = false
id,msg = rednet.receive()
print(id)
print(msg)
if msg == "locate" then
locate()
omsg = {err, x, y, z}
osmsg = textutils.serialize(omsg)
print(osmsg)
rednet.send(id,osmsg,true)
end
end
8543 posts
Posted 18 January 2013 - 08:50 AM
gps.locate broadcasts "PING" via rednet. Your program that asks the other computer to find its location only listens for the next rednet message, which will almost certainly be the "PING" that the other computer sends out to find its location.
3 posts
Posted 19 January 2013 - 07:10 AM
ok i understand
so if i implement in the receiver computer that it only listens to an message of the computer he sends the location request and if not an while loop until it receives an message of this computer, than it should work. thank you i forgot the rednet messege of the gps hosts.