title: How to print a bill from POS printer in .net using socket?
body: <p>I have an ASP Web API and network printer(Epson TM-U220). I need to select the printer by code and print a bill. I just try as bellow. But not work fine.
  <a href="https://i.stack.imgur.com/sCoJ1.jpg" rel="nofollow noreferrer">I want to print this direct using pos printer</a></p>
  <pre><code>var server = &quot;192.168.1.164&quot;;
  var nome = &quot;www.pdf&quot;;
  
  Socket clientSocket = new Socket(AddressFamily.InterNetwork, 
  SocketType.Stream, ProtocolType.Tcp);
  clientSocket.NoDelay = true;
  
  IPAddress ip = IPAddress.Parse(server);
  IPEndPoint ipep = new IPEndPoint(ip, 9100);
  clientSocket.Connect(ipep);
  
  clientSocket.Send(File.ReadAllBytes(nome));
  clientSocket.Close();
  </code></pre>