0

I need to update this program to print to whichever printer the user has selected as their default printer. Currently I'm using the IP address of the printer but it will be different depending on the pc.

Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        clientSocket.NoDelay = true;

        PrinterSettings settings = new PrinterSettings();
        IPAddress ip = IPAddress.Parse("ipaddress");
        IPEndPoint ipep = new IPEndPoint(ip, 9100);
        clientSocket.Connect(ipep);

        try {
            clientSocket.Send(output.ToArray());
        } catch (Exception) {}
zege105
  • 1
  • 1
  • What if the default printer is not a network printer? – D Stanley Jan 30 '19 at 23:06
  • 1
    Seems like you need to combine [this answer](https://stackoverflow.com/questions/938873) and [this answer](https://stackoverflow.com/a/22162805/1081897) – D Stanley Jan 30 '19 at 23:11

0 Answers0