title: How to use python socket to send data from a driving simulator PC to a laptop?
body: <h2>Goal</h2>
  <p>A driving simulator PC generates real-time data (1/60th of a second) that I can get via <code>socket</code>. I connected a laptop to this PC via ethernet cable. Now, I want to send the data from PC to the laptop OR get the data directly in laptop via <code>socket</code>. Following is the setup:</p>
  <p><a href="https://i.stack.imgur.com/tiwIG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tiwIG.png" alt="enter image description here" /></a></p>
  <h2>routeTable.txt specifies how to get data from the simulator</h2>
  <p>Following text file is located at <code>DrivingSimulator/bin.x64</code> on PC. I have put the stars <code>*</code> to highlight the IP address and ports</p>
  <pre><code>rem This is  a test for vehicle position
  rem name                                        type    size
  var
      FrameNum                                    i       1
      VDS_Chassis_CG_Position                     d       3
  end
  rem Here we format each variable for output, we can change the size of the output here if we want
  rem DevID   type    size    is Expr/Name    Name or Expression
  device
      1       i       1       n       &quot;FrameNum&quot;
      2       d       3       n       &quot;VDS_Chassis_CG_Position&quot;
  end
  
  rem These are the input devices
  rem id  CellName                                    offset(byte)    size(Byte)
  input
        
      
  end
  
  rem ID  **IP address**  **In port** **Out port**    Packed?     List of devices
  route
      1   **127.0.0.1**   **9000**    **9001**            1           2
  end
  </code></pre>
  <h2>UDP.py contains the code to get data in PC in python via <code>socket</code></h2>
  <p>The following python script when run on PC, prints out the data in python console successfully:</p>
  <pre><code>import socket
  import struct
  
  UDP_IP = &quot;127.0.0.1&quot;
  UDP_PORT = 9000
  
  sock = socket.socket(socket.AF_INET, # Internet
                       socket.SOCK_DGRAM) # UDP
  sock.bind((UDP_IP, UDP_PORT))
  
  while True:
      data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
      fields = struct.unpack_from('=ddd', data)
      print(fields[0],fields[1],fields[2])
  </code></pre>
  <h4>Print</h4>
  <p><a href="https://i.stack.imgur.com/aJVbg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aJVbg.png" alt="enter image description here" /></a></p>
  <h2>How do I get the same data on the attached laptop?</h2>
  <h3>What I tried:</h3>
  <p>The laptop is connected to PC via an ethernet cable. I tried running the <code>UDP.py</code> script on the laptop, it did not print out anything on the terminal, but also did not throw any error. Then I thought I should use the IP of the laptop. So, I tried that by changing the <code>UDP_IP</code> in <code>UDP.py</code> and the <code>IP address</code> in <code>routeTable.txt</code> with the laptop's IP i.e., <code>192.168.x.yy</code>. Same behavior: no print out but also no error.</p>
  <h3>Question:</h3>
  <p>How do I get the data on the laptop?</p>