This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dylan's profile picture

Server Client Login System problems

Started by dylan, 06 April 2012 - 03:48 PM
dylan #1
Posted 06 April 2012 - 05:48 PM
Hello I am trying to have a central server that holds a list of usernames and passwords. I have the client send the username name to the server but the server never receives the message.
This is the server's code

while true do
	print("Listening for login requests")
	rednet.open("top")
	usernames = {}
	usernames[1]="Dylan"
	usernames[2]="Devon"
	usernames[3]="Gio"
	id, user = rednet.receive()
	print(user)
end
This is the client's code

rednet.open("top")
print("Welcome to Dylan's house")
write("Username: ")
status , input = pcall(read)
rednet.send(7, input)
while id ~= 7 do
	id,message = rednet.receive()
end
Thank you for the help
cant_delete_account #2
Posted 06 April 2012 - 07:22 PM
Try making: status , input = pcall(read) Into: status, input = pcall(read)
(No spacing inbetween comma)
Hawk777 #3
Posted 06 April 2012 - 07:50 PM
The spaces before the comma should be fine I believe. So the server never prints out the received username? Do both computers' modems light up when the programs are running, indicating they're working right (if you're using modems)? Also, if you're using modems, are they within 64 metres of each other?
dylan #4
Posted 06 April 2012 - 08:53 PM
the problem actually was that I didn't understand how the modems were to attach to the computer. the code was perfect.