Sometimes I have problem with printer, and I must log-off my user from RemoteApp server, but I do not have access to this server.
When I close RemoteApp, connection will not be disconnected and wait my action. When I disable wireless adapter, connection will be disconnect.
Is it possible to write script for disconnection RemoteApp?
The solution is simple: I can kill process mstsc.exe.
Related
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
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
I have got step by step information on how to enable/set/modify the keep alive option on MSSQL Server side. But, how to do the same while using ODBC client to connect with MSSQL Server? This is mainly used to close the socket on client side and start reconnecting.
I came across an option called "Connect Timeout
-or-
Connection Timeout", in connection string, which disconnects if there is no connection after that timeout. But i hope TCP keep alive does more than this.
Couple of options would do for me,
1) Is there a keepalive option that could be added in connection string (similar to postgres)?
2) How to get the client socket fd, which connects with the MSSQL Server, (without using OS commands) so that, i could use setsockopt API and enable keep alive
During app loading a single user will add 10 connections to the pool. Then if I load another user I will have a total of 20 connections.
Why are new connections being added to the pool instead of reusing connections? I can see that that there are connections available that haven't been used in minutes yet it still opens new connections.
Its the same connection string
I ran SQL Sever Profiler I can see sp_reset_connection being called after every call.
Any help would be appreciated.
If the connections are coming from a different machine, the connections can't be pooled. A connection required both endpoints to be a connection. If you are using connection pooling correctly, applications instantiate a connection (from the pool), use the connection, then drop it as soon as exchange is complete.
If you a writing a single-threaded desktop app, another common and simple strategy is to open a connection, and just leave that connection open as long as the application is running.
You can control how many connections are created, etc. see MS article for more details related to connection pooling.
IIRC, connection pools are not shared unless the connection string is identical either.
I have setup a nagios distributed monitoring system environment and i am able to send passive checks to Nagios server using send_nsca. When i look at the handshake between Nagios Client and Nagios Server, i see that Nagios Client is establishing a tcp connection to Nagios server whenever it has something to send and terminating the connection once the client is done sending the information. I want the tcp connection to stay up forever instead of terminating every time after data transfer is done. Could anyone please let me the know the process to make this happen?
You cannot do this without modifying the standard NSCA daemon. Normally, it will time out and that's why the NSCA client reestablishes the connection.
I've implemented send_nsca in both Perl and Ruby, and in both cases cannot make a persistent connection work.
A better solution, though, if you are using Nagios 3.x is to install the livestatus module (part of check_mk). This allows passive checks to be submitted, but supports a persistent connection and a whole lot more. We've moved to using this instead for many cases.
I built a VB .NET app which has a connection to SQL Server. While the app is running, the Windows OS changes to sleep mode. After I turn the machine on again, I found this error:
A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
The connection's state is still OPEN, but it no longer works. I've read some resources from MSDN said the SPID has been terminated(?).
Is it possible to get this connection working again after Windows OS sleep?
If not, I may decide to END the running app..
SQL Server detected that the client wasn't there on sleep, so closed the session, released locks, rolled back etc.
Your application thinks "open" because it simply remembers it state.
You should open connections as you need and close afterwards so you won't end up in this condition. The open/close has little overhead because of connection pooling