title: Trying to send data via Socket to a ZVT Terminal
body: <p>How can I send data to a listening Terminal ?!?! (see task)</p>
  
  <p>Szenario is:</p>
  
  <p>I have a terminal that is listening on a IP:PORT e.g. 192.168.1.100:12345</p>
  
  <p>I create a socket and connect like</p>
  
  <pre><code>$socket = socket_create(AF_INET, SOCK_STREAM, 0);
  $result = socket_connect($socket, $host, $port);
  </code></pre>
  
  <p>Now I want to write data to the socket. The data i have looks like:</p>
  
  <pre><code>0x06 0x01 0x07 0x04 0x00 0x00 0x00 0x00 0x00 0x69
  </code></pre>
  
  <p>actually the terminal should show up <code>0.69 cent</code> in the display. But i need to send the data infront of the <code>0x69</code> too.</p>
  
  <p>I'm sending the Data like</p>
  
  <pre><code>socket_write($socket, $data, strlen($data));
  </code></pre>
  
  <p>I have read some about a php <code>pack()</code> function and tried this...</p>
  
  <pre><code>$data = pack( "C", "\x06\x01\x07\x04\x00\x00\x00\x00\x00\x69" );
  </code></pre>
  
  <p>what i have also tried is</p>
  
  <pre><code>$data = pack("c","\x06\x01\x07\x04\x00\x00\x00\x00\x00\x69");//nothing happens
  $data = "0x06 0x01 0x07 0x04 0x00 0x00 0x00 0x00 0x00 0x69";//nothing happens
  </code></pre>
  
  <p>but this doesn't do the thing.</p>
  
  <p>I friend of mine worte a programm in c++ and it works easy.</p>
  
  <p><strong>TASK</strong></p>
  
  <p>Task is to send data in 8bit format and as hex.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><strong><a href="http://pastebin.com/JDbfCSvd" rel="nofollow">C++ Code</a></strong></p>