Jump to content




Howd you make a rednet-enabled server?


  • You cannot reply to this topic
10 replies to this topic

#1 ry00000

  • Members
  • 244 posts
  • LocationComputer, Base, SwitchCraft, Cube-earth, Blockiverse, Computer

Posted 30 January 2016 - 06:09 PM

like, for example, a computer sends via rednet a string to the server and the server stores it in a file. (i.e logs it)

#2 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 30 January 2016 - 06:30 PM

have you looked at the computercraft wiki? if you scroll down to the bottom then you will get a list of all of the (default) APIs

to do your example you will need the rednet API and the fs API

Edited by Lupus590, 30 January 2016 - 06:33 PM.


#3 ry00000

  • Members
  • 244 posts
  • LocationComputer, Base, SwitchCraft, Cube-earth, Blockiverse, Computer

Posted 30 January 2016 - 06:56 PM

yeah, rednet and fs. Give me some example code plz.

#4 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 30 January 2016 - 09:19 PM

--#I have made no effort to make sure that this is valid lua
local file = fs.open(filepath,"a")
while true
  file.write(rednet.receive())
  file.flush()
end

Edited by Lupus590, 31 January 2016 - 02:15 PM.


#5 Waitdev_

  • Members
  • 432 posts
  • LocationAdelaide

Posted 30 January 2016 - 11:50 PM

View PostLupus590, on 30 January 2016 - 09:19 PM, said:

--#I have made no effert to make sure that this is valid lua
local file = fs.open(filepath,"a")
while true
  file.write(rednet.receive())
  file.flush()
end
i think you're forgetting some things:
file.close()
unless you're not gonna add a break to the program

while true do --#instead of while true

Edited by Waitdev_, 30 January 2016 - 11:52 PM.


#6 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 31 January 2016 - 02:15 PM

View PostWaitdev_, on 30 January 2016 - 11:50 PM, said:

while true do --#instead of while true

View PostLupus590, on 30 January 2016 - 09:19 PM, said:

--#I have made no effort to make sure that this is valid lua

and yes, you should close your file at some point

Edited by Lupus590, 31 January 2016 - 02:16 PM.


#7 ry00000

  • Members
  • 244 posts
  • LocationComputer, Base, SwitchCraft, Cube-earth, Blockiverse, Computer

Posted 31 January 2016 - 03:14 PM

I'm trying to make a bank. Should I store the stuff in a rednet server? And how do I program the turtle that will top up?

#8 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 31 January 2016 - 05:21 PM

View Postry00000, on 31 January 2016 - 03:14 PM, said:

I'm trying to make a bank. Should I store the stuff in a rednet server? And how do I program the turtle that will top up?

To make a bank program, you'd need a 'server' to save the account names,passwords, and balances of each user.

Then a client program would send requests to the server, like creating an account or transferring funds.

What does a turtle have to do with anything?

#9 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 31 January 2016 - 07:00 PM

View PostHPWebcamAble, on 31 January 2016 - 05:21 PM, said:


What does a turtle have to do with anything?

at a guess, transporting items to and from the vault

#10 ry00000

  • Members
  • 244 posts
  • LocationComputer, Base, SwitchCraft, Cube-earth, Blockiverse, Computer

Posted 05 February 2016 - 12:05 PM

No, it holds the items and puts them in a secure chest from industrialcraft 2.

#11 wilcomega

  • Members
  • 466 posts
  • LocationHolland

Posted 05 February 2016 - 01:29 PM

Well you will need to store user data like username / password and balance on the server, then a computer with a client program connects to the server and asks the server to do something like transfer money, or deposit money. of course the security needs to be very good on these kinds of Servers as you dont want someone to order the server to transfer money from someones account to the hackers account. you should probably look into hashing the passwords and keeping log files.

there is also the problem of distinguising between regular clients and ATMS's, i dont know what sort of features you will have but these are some guidelines :)

Edited by wilcomega, 05 February 2016 - 01:32 PM.






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users