Blockland Forums > Modification Help
Where/What type of server do i use to send and recieve data
Lugnut:
was it this: http://heroku.com ?
Fluff-is-back:
--- Quote from: Lugnut1206 on April 30, 2012, 04:00:38 PM ---was it this: http://heroku.com ?
--- End quote ---
Quite similar
Slicks555:
Well, I didn't take the time to read through the entire thread but I get the gist of it. I've personally done exactly what you're asking, down to purchasing servers to use to host data. Granted, they don't support my IM stuff anymore, but whatever. You can have my old stuff if you want though, you'll need to provide the server though.
The ruby server. You'll need to install ruby to run this, but it's not difficult.
The client chat mod. This is not really what you're looking for, but it can be easily adapted. This links two servers chats, but you can clearly see how to send and receive messages, so it should do.
As far as server hosting goes, it depends on your tastes. Look for a VPS of the operating system you like. I personally like Linux so I own a few VPSes from Linode. A quick google search will find you some with windows on them, if you so please. But beware, you have to pay a monthly fee for these and they're not easy to use for someone with no IT experience. I recommend you forward a port and host the server off your own computer.
Brian Smithers:
--- Quote from: Destiny/Zack0Wack0 on April 06, 2012, 01:14:47 AM ---Ruby
--- Code: ---require "socket"
port = 1234
server = TCPServer.new port
loop do
Thread.start(server.accept) do |client| # connected
client.puts "hi" # send data
loop do
msg = client.gets # receive data
end
end
end
--- End code ---
Node.js:
--- Code: ---var net = require("net");
var port = 1234;
net.createServer(function(client) {
client.write("hi"); // send data
client.on("data", function(msg) {
// received data
});
}).listen(port);
--- End code ---
Python
--- Code: ---import socketserver
class Handler(socketserver.BaseRequestHandler):
def handle(self):
request = self.request
request.send("hi")
msg = request.recv(1024)
if __name__ == "__main__":
port = 1234
server = SocketServer.TCPServer(("localhost", port), Handler)
server.serve_forever()
--- End code ---
--- End quote ---