0

I have a client process running in windows (win 7/win 2008 server). The task is to enable keepalive for one of the socket it opened to get connected with a server. To make this connection i'm using windows API (connection to MSSQL server), from which i was unable to retrieve the socket fd it created.

1) What is the way to retrieve all the socket fds opened by a windows process (non python method, as the binary is a C++ based)

2) Is there any way to retrieve socket fd from the handle returned by the windows API SQLAllocHandle or SQLDriverConnect

Thanks

JOE
  • 77
  • 2
  • 10

1 Answers1

0

You can't (AFAIK) and shouldn't (not supported) try to modify this on the client. SQL Server has a server-side configuration setting that controls this:

Keep Alive

This parameter (in milliseconds) controls how often TCP attempts to verify that an idle connection is still intact by sending a KEEPALIVE packet. The default is 30000 milliseconds.

https://technet.microsoft.com/en-us/library/ms190771(v=sql.105).aspx

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67
  • Thanks. I'm aware about this parameter on server side, but interested to enable on client side. What do you mean by "not supported"? Is that, modifying keepalive on socket is not supported on windows after connection establishment? – JOE Jul 10 '17 at 05:06
  • It's not supported to directly modify the socket used by the SQL Server ODBC driver, even if you could find the handle. – David Browne - Microsoft Jul 10 '17 at 12:56