ZBR2956649 Zebra printer not connected with C#

Dears,

While connecting the zebra printer often we are getting this issue “Syste.Net.Sockets.SocketExceptions: No Connection could be made because the target machine activity refused”, but when we restart the printer, it’s working properly for some time, later same issue occurring. But when we check the printer status it's always stable with Ready state, I can able to make changes in setting and IP is also ping able.

Our system try to connect the printer 5secs once, even same error has occurred until printer restart. We are using the basic socket C# code for this.

Please find the attachment of C# code what we are using for connect the Printer.