title: Connect to Google cloud server via python
body: <p>I want to connect my laptop (and later a raspberry pi/Jetson nano) to a Server. The goal is to be able to send data to the server then process and evaluate it and send the output (GPS coordinates) back to the client (laptop/raspberry pi/Jetson nano).
  Ideally, I would just plug in the public IP address of the Google Server into the code that is run on the client and connect to the server.</p>
  <p>However, running the server code:</p>
  <pre><code>import socket
  
  HOST = '127.0.0.1'  # Standard loopback interface address (localhost)
  PORT = 65432        # Port to listen on (non-privileged ports are &gt; 1023)
  
  with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
      s.bind((HOST, PORT))
      s.listen()
      conn, addr = s.accept()
      with conn:
          print('Connected by', addr)
          while True:
              data = conn.recv(1024)
              if not data:
                  break
              conn.sendall(data)
  </code></pre>
  <p>and the client code:</p>
  <pre><code>import socket
  
  HOST = '127.0.0.1'  # The server's hostname or IP address
  PORT = 65432        # The port used by the server
  
  with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
      s.connect((HOST, PORT))
      s.sendall(b'Hello, world')
      data = s.recv(1024)
  
  print('Received', repr(data))
  </code></pre>
  <p>provided by: <a href="https://realpython.com/python-sockets/" rel="nofollow noreferrer">https://realpython.com/python-sockets/</a> .</p>
  <p>Will only work with the default local IP address otherwise it returns a IP address couldn't be found error.</p>
  <p>EDIT: The answer was more directed towards internet connection via the google cloud API. The solution illustrates this perfectly, however my question was not explicit enough sorry!</p>