767 posts
Posted 05 November 2012 - 04:49 AM
HEy guys…
i have been making a mail system, where i have 1 Server Pc (that receives alle mails, and send them to the specific PC) and 2 client PC's(or more)
i only have 1 problem… i have a server pc, and want it to receive all mails.. :
1 pc. (client)
pc 1 sending (Hello I am a test Mail)
to the serverpc, wich will send the mail to pc 2.
but… how is this possible… i have maade this test…
id, msg = rednet.receive()
rednet.send( , ..msg) how can i turn the first 2 letters / numbers of the msg into strings, so it can send to id, 5 or 2 ?
i dont know how i can do this.. can anyone please help me?
818 posts
Posted 05 November 2012 - 05:11 AM
well…..
Your post is very confusing. What exactly are you trying to do? From what I got you have 1 computer, which you want to send mails to the other computer. then you want that computer to be able to send mails back as well? But at the same time you want a server inbetween which gets the mails and distribute them?
767 posts
Posted 05 November 2012 - 06:14 AM
oh.. yh something like that.. but. i have 2 normal computers with the same program… then i have 1 other pc, that is called the "Server".. the server has to receive the first computers message. that would mean:
PC 1
Hello '5' this is a test.
The server receives that msg.
then send it to the computer id "5"
and then PC2 (id = 5 ) receives the
Hello this is a test
do you know what i mean. if not, then can you plese help me with the "Rednet" commands (the advanced rednet commands, like :
id, msg = rednet.receive()
and some other things
818 posts
Posted 05 November 2012 - 06:31 AM
well, my approach would be to have the first pc send '005 Hello this is a test'
then, the server gets the message, does
sendID = tonumber(string.sub(message,1,3))
then
newmessage = string.sub(message, 4, #message)
then
rednet.send(sendID, newmessage)
767 posts
Posted 05 November 2012 - 06:51 AM
thanks but now i figured it out.. after alot of tries.. but i got this error…
my code + console look
the thing it shows:
10 - 11
msg from - 10 - 1111 –[[1111 is the current msg, i typed in]]–
rednet:347: positive number expected
My code:
rednet.open("right")
i1, mg = rednet.receive()
print(""..i1.." - "..mg.."")
a1, ms1 = rednet.receive()
print("msg from - "..a1.." - "..ms1)
rednet.send("..mg..", ""..ms1.."")
818 posts
Posted 05 November 2012 - 07:17 AM
ehrm
rednet.send("..mg..", ""..ms1.."")
makes no sense.
plus ms1 is the message received.
print(""..i1.." - "..mg.."")
makes no sense either
767 posts
Posted 05 November 2012 - 08:06 AM
My server pc is first receiving 1 msg. That is which computer the next msg, should be sent to. But can i make rednet.send("..i1..", ""..msg.."") so it would take the first messages, "text" (which in this case is 11) , and then make a variable which id 11?????
818 posts
Posted 05 November 2012 - 08:32 AM
wait
I think you definetly got your variables wrong. Before you continue, go back to basic variable training and learn how to use variables correctly.