title: sending and receive data from client using python
body: <p>I am using 
  <a href="http://en.usr.cn/Wifi-Serial-Server/RS485-to-WIFI-802.11-B-G-N-Converter.html" rel="nofollow">RS485 to wifi router</a></p>
  
  <p>above model for Rs485 communication.</p>
  
  <p>Intailly  I tried simple code with arduino. WIth sending serial data over client for every 2S.</p>
  
  <pre><code>void setup()
  {
  Serial.begin(9600);  
  }
  
  void loop()
  {
   Serial.println("SMCB1,1,1,1,1,2,3,4,5,6,6,7,8,9,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2"); 
    delay(2000);
  }
  </code></pre>
  
  <p>I used below python code, to receive data from client 1 and client 2</p>
  
  <pre><code>import socket
  
  TCP_IP = '192.168.1.3'
  TCTCP_IP1='192.168.1.2'
  TCP_PORT = 8899
  BUFFER_SIZE = 100
  BUFFER_SIZE1=100
  MESSAGE = "Hello, World!"
  
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.connect((TCP_IP, TCP_PORT))
  s1.connect((TCTCP_IP1, TCP_PORT))
  
  s.send(MESSAGE)
  s1.send(MESSAGE)
  data = s.recv(BUFFER_SIZE)
  data1= s1.recv(BUFFER_SIZE)
  
  s.close()
  s1.close()
  print "received data:", data
  print "received data:", data1
  </code></pre>
  
  <p>Now i have uploaded the Modbus RTU code , where i am sending request and trying to get response. Request need to send in Hex format. I tried with wired communication seems working fine.
  I have shared request format below. But i could able to read any thing process will under progress to read</p>
  
  <pre><code>import socket
  
  TCP_IP = '192.168.1.3'
  TCTCP_IP1='192.168.1.2'
  TCP_PORT = 8899
  BUFFER_SIZE = 1000
  BUFFER_SIZE1=1000
  
  #MESSAGE = "01 03 00 00 00 1d 85 c3"
  #MESSAGE1 = "02 03 00 00 00 1d 85 fo"
  
  MESSAGE = "01030000001d85c3"
  MESSAGE1 = "02030000001d85fo"
  
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  
  print "Before connect"
  
  s.connect((TCP_IP, TCP_PORT))
  s1.connect((TCTCP_IP1, TCP_PORT))
  
  print "After connect"
  print MESSAGE
  print MESSAGE1
  
  print "request before sending"
  s.send(MESSAGE1)
  s1.send(MESSAGE)
  print "request after  sending"
  data = s.recv(BUFFER_SIZE)
  data1= s1.recv(BUFFER_SIZE)
  
  s.close()
  s1.close()
  print "received data:", data
  print "received data:", data1
  </code></pre>
  
  <p>Now problem I am facing i am trying to send request but i could not able to get reply. With wired communication i can able to get data.</p>