title: python Socket send ascii command and receive response
body: <p>I am trying to establish connection to a ADAM-4017+ I/O module over the network using a Lantronix EDS2100 module through socket communication in python.  For the life of me I cannot get it to work.</p>
  
  <p>The EDS has an IP address and a port (10001) that the adam unit is connected to.  I am trying to query the adam for the value of ch 1 (ascii command is #000)  </p>
  
  <p>Any help greatly appreciated:</p>
  
  <pre><code>import socket
  edsIP = "192.168.1.135"
  edsPORT = 10001
  MESSAGE="#000\r"
  
  
  srvsock = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
  srvsock.bind( ('',23000))
  srvsock.listen(1)
  newsock, (remhost, remport) = srvsock.accept()
  srvsock.send((MESSAGE),(edsIP, EdsPORT) )
  
  
  
   while 1:
  
  
      data, addr = srvsock.recv(4096) 
      print ("received message:", data,addr)
      srvsock.close()
  </code></pre>