title: How to integrate payment POS to NETS terminal using IP and port (send and receiving data response)
body: <p>NETS ECR II Terminal Interface Technical Specification Document V1.18</p>
  <p>I need to send some HEX value &quot;02001841313233343536373839304243433031301C0334&quot;
  to POS terminal, amount of money, and POS will then check if debit card if valid then send me some response &quot;02002741313233343536373839304243433030301C46430004444154411C0307&quot; ..like this:</p>
  <p>Please take look at the below code this is the way, I am sending hex data to NETS ECR II Terminal but the NETS terminal response not came in valid format.</p>
  <pre><code>try
  {                               
      var endPoint = new IPEndPoint(IPAddress.Parse(&quot;192.168.0.000&quot;), 4000);
      using Socket client = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
  
      await client.ConnectAsync(endPoint);
      while (true)
      {
          // Send message.
          var message = &quot;02001841313233343536373839304233303031301C0334&quot;;                  
          var messageBytes =  Encoding.UTF8.GetBytes(message);
          _ = await client.SendAsync(messageBytes, SocketFlags.None);
          Console.WriteLine($&quot;Socket client sent message: \&quot;{message}\&quot;&quot;);
          // Receive ack.
          var buffer = new byte[1024];
          var received = await client.ReceiveAsync(buffer, SocketFlags.None);;
          var response = Encoding.UTF8.GetString(buffer, 0, received);
          txtresponse.Text = response;
          message = ((char)0x02).ToString();
          if (response == &quot;&lt;|ACK|&gt;&quot;)
          {
              Console.WriteLine(
                  $&quot;Socket client received acknowledgment: \&quot;{response}\&quot;&quot;);
              break;
          }
          // Sample output:
          //     Socket client sent message: &quot;Hi friends !&lt;|EOM|&gt;&quot;
          //     Socket client received acknowledgment: &quot;&lt;|ACK|&gt;&quot;
      }
  
      client.Shutdown(SocketShutdown.Both);
  }
  catch(Exception ex)
  {
      
  }
  </code></pre>
  <h3>data sending format</h3>
  <p><img src="https://i.stack.imgur.com/EX3Gd.jpg" alt="data sending format" /></p>
  <h3>data receiving format</h3>
  <p><img src="https://i.stack.imgur.com/07urk.png" alt="data receiving format" /></p>