Hello there,
If you specifically need to get information from TCP/IP you might need to look into transceive (Xcv) interface.
The article below describes the transceive (Xcv) interface for the standard TCP/IP port monitor (TCPMON). This interface, which is implemented using XcvData and XcvDataPort function calls, enables those using it to configure a TCP/IP printer port or to obtain information about a TCP/IP printer port configuration. The Xcv interface described in this section is specific to TCP/IP ports. Other Xcv interfaces might be available for other port types.
More info here https://learn.microsoft.com/en-us/windows-hardware/drivers/print/tcpmon-xcv-interface
Microsoft provides a language monitor, Pjlmon.dll, which supports printer job language (PJL), and provides bidirectional communication for PJL printers.
Language monitors https://learn.microsoft.com/en-us/windows-hardware/drivers/print/language-monitors
------------------------------------------------------------------------------------------------------------------------------------------------
--If the reply is helpful, please Upvote and Accept it as an answer–