title: Raw TCP Listen Socket on Cloud or Web Server
body: <p>I have hardware that connects to raw TCP socket on any given IP and port combination. It then continually sends characters. The following piece of Python code may give you an idea of what the hardware does.</p>
  
  <pre><code>import socket
  
  serverIP = '*server IP or domain*'
  serverPort = 60000
  
  Sock = socket(AF_INET, SOCK_STREAM)
  Sock.connect((serverIP, serverPort))
  while (1):
  f = open ("send-data.txt","r")
  while 1:
      c = f.readline()
      if not c:
          break
  Sock.send(c + '\n')
  
  Sock.shutdown(0)
  Sock.close()
  </code></pre>
  
  <p>When this code is run it exactly behaves like my hardware system. The <code>send-data.txt</code> file contains characters similar to what hardware sends. </p>
  
  <p>I have written a socket server in Python using <code>SocketServer</code> library. It allows connections, receives character stream, and stores it into a local (newly created) file. Currently, I am running this code on my system, as <code>localhost</code> and it works. I would like to serve these files through a webpage.</p>
  
  <p>I want to be able to do the same on remote server. As you can see, my hardware limits me to use only raw TCP sockets. From what I understand, I'll need low-level access to the server machine like IaaS. I tried <a href="https://www.pythonanywhere.com" rel="nofollow">pythonanywhere</a>, but I guess they don't allow simple python sockets. Heroku also requires you to write a web app, and I don't know how to go about that or whether it'll work with my hardware.  </p>
  
  <p>What hosting/Cloud solution out there could act as above-mentioned socket server and also as HTTP server which would later serve these files and webpages. </p>