TCP Server Response
<p>I'm writing a TCP python script that will act as a client and retrieve a temperature reading from a LakeShore336 Temperature Controller (which is acting as the server). I need to pass a command to the server from the client and output the response. I get outputs up to 'Spot 2' after the command is sent but when s.recv is called I'm left hanging. (Python 2.7)</p>

<p>Client.py</p>

<pre><code>import socket

ip = '192.168.62.233'
port = 7777              # The same port as used by the server/machine
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, port))

print 'Spot 1'
s.send('KRDG? A[term]')
print 'Spot 2'
data = s.recv(4096)
print 'Spot 3'
s.close()
print 'Received', repr(data)
</code></pre>

<p>EDIT:
In the end I just needed to add</p>

<pre><code>s.send('KRDG? A\r\n')
</code></pre>

<p>So that there was a terminator. Thanks for the help</p>