Author Topic: Where/What type of server do i use to send and recieve data  (Read 2349 times)


Look, I know for a fact that both of you have access to dedicated servers and dedicated internet connections.
despite me living in the 21st century, i don't have that.

dedicated internet connections

so your internet connection automatically turns off on a static schedule

cool

I also cannot port forward for reasons I don't feel like wasting my time discussing.
and no, not a static schedule.
it just doesn't run when i'm not at home, which is a large portion of the time

there was a really cool website I found a while ago, that you could run applications on as servers for free, let me find it.



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.
« Last Edit: April 30, 2012, 08:46:54 PM by Slicks555 »

Ruby
Code: [Select]
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

Node.js:
Code: [Select]
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);

Python
Code: [Select]
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()