title: Send data over TCP/IP with Netcat or Rails
body: <p>I have an IP of the server and a port on which I'm able to connect via nc on Ubuntu 14.04.</p>
  
  <pre><code>&gt; nc x.x.x.x PORT
  </code></pre>
  
  <p>In order to communicate with the server, the first step is to send a WAKEUP call and get acknowledgment. The server expects a 3 byte ID in the wakeup call. An example is provided in the documentation that shows the success scenario of sending the ID and receiving the ack using a software. i.e</p>
  
  <p>The client sends:</p>
  
  <pre><code>&lt;sy&gt;&lt;sy&gt;&lt;eq&gt;111&lt;et&gt;
  </code></pre>
  
  <p>And the server responds with:</p>
  
  <pre><code>&lt;sy&gt;&lt;ak&gt;A&lt;et&gt;&lt;cr&gt;
  </code></pre>
  
  <p>Here is some detail of <code>&lt;sy&gt;</code></p>
  
  <blockquote>
    <p>Within &lt;> brackets is a non-printable ASCII character (<code>&lt;sy&gt;</code> = ASCII 22 or Hex 0x16)</p>
  </blockquote>
  
  <p>I tried to replicate the exact same scenario but failed to do so. The server doesn't respond to the data I send, although the data is received there. I'm not sure about these tags <code>&lt;sy&gt;&lt;sy&gt;&lt;eq&gt;</code> etc. How to send the ID(111) along with these tags <code>&lt;sy&gt;</code> correctly?</p>
  
  <p>Also tried to send this data using Rails framework and <a href="https://github.com/dmendel/bindata" rel="nofollow noreferrer">Bindata</a> ruby gem but don't know how to represent the above format.</p>