How to initialize and connect to OpenLDAP Server without using ldap_open() function.
I would like to test the feature LDAP test connection for this I need to open a connection with timeout and close it to check if the connection is available or not.
Just create a socket and call connect(), using non-blocking mode and your choice of select()/poll()/epoll() to control the timeout. Close it immediately on success, don't send anything.
Related
My Mirth Connect v3.4 channel's File Reader source connector is configured as the SFTP reader to poll files from a remote server every 20 minutes and it works as expected.
But when the channel goes idle it starts sending keepalive#jcraft.com messages to the remote server every 10 seconds regardless of the Timeout setting of that source connector.
Is there anything else to configure to stop these messages from being sent to keep connection alive or is there any workarounds other than restarting the channel after each poll by some other channel?
From the JSch changelog:
change: at TCP socket reading timeout, keep-alive message will be sent
to the remote sshd. To disable this functionality, invoke
explicitly Session.setServerAliveCountMax(0)
Unfortunately JSch does not provide any way to set this value from its own configuration file. So you'll have to use JavaScript and create a Session manually.
I am using a lua script to push paramters into redis from a nginx http server
https://github.com/openresty/lua-resty-redis
I do not want to make a new connection to redis server everytime. Can I persist the redis connection. Also is there an option to make this async
If you use set_keepalive specifying the connection pool size (2nd paramater), when you connect, the lua-resty-redis library will automatically try to resolve a previous idle connection if any.
It also allows to specify a custom name for your pool. It is all decribed in 'redis#connect' method documentation:
Before actually resolving the host name and connecting to the remote backend, this method will always look up the connection pool for matched idle connections created by previous calls of this method.
An optional Lua table can be specified as the last argument to this method to specify various connect options:
pool
Specifies a custom name for the connection pool being used. If omitted, then the connection pool name will be generated from the string template <host>:<port> or <unix-socket-path>.
As for the "async" requirement, the library is already 100% nonblocking.
Is there a way to save the "state" of Winsock so that the server program can be stopped and restarted and all the client TCP connections continue as though nothing happened, without the clients having to do anything special?
Or is it the case that once a Winsock server process terminates, client connections can only be reestablished through all the usual initialization calls?
A lost/closed connection must be re-established through a new connect handshake. So if you don't want the client to know the server is restarted, you will have to move the existing connection to another process first, then move it back after the restart. You can use WSADuplicateSocket() for that.
In the SignalR (server) hub I want do a license check. If the check negativ then I want in the OnConnected of the Hub block the connection. The client should get in the Hub start the Task as canceled with a message (no valid licence).
When I return a Task with a Aggregate Exception in the OnConnected of the SignalR Hub then the client gets a fault state, with a timeout exception.
How can I block the connection to the SignalR hub and give the client a message why I have block the connection?
As far as I know you can't just start or stop connections already on the server. The client has to disconnect itself. If you want to use the hub for licence check you need to have the client connect - send licence info - server checks and if it is invalid call $client.disconnect on the client.
The other option like blorkfish mentions is to allow them to connect, add them to a list and check this when they call methods on the server.
I don't think that you should block the connection with an Exception. Your client would then not be able to tell if there was a genuine error in the SignalR connection.
Rather send a specific SignalR message back that there is no license - and then manage the connection object on the server side.
Keep a list of licensed connections, and a list of unlicensed connections.
So instead of using Clients.All to broadcast, use Clients.Client("< client_connection_id >") to broadcast.
Hope this helps.
I connect to my server, which is load balanced for an alias to point to 2 servers, 01 & 02 and it round-robins connections for arguments sake. I can connect to the hub without a problem, and I can even send stuff to the server, but when it goes to return it to the client, I never get my methods invoked. If I bypass the load balancer and use the server name explicitly, it always works just fine.
I'm even tracing it, and I send back the message from the exact originating server with the Clients.Client(clientId).completeJob(stuff), and that executes fine on the server, but if I ContinueWith, it never gets finished.
Oh, and it's connected with server sent events. Am I missing something or is this just not supported?
Server-sent events establishes a long running connection, but unlike WebSockets, it isn't bidirectional. The connection can only be used to push data to the client.
SignalR uses regular XHRs to send data from clients when the WebSocket transport is unavailable. This means that the load balancer will likely route client-to-server hub method invocations to a server different than the one the client originally established a server-sent event connection with.
The server executing Clients.Client(clientId).completeJob(stuff) likely doesn't own the connection that would allow it to push a message to the specified client. (Though returning a value from a hub method on the server will send data back to the client via the same connection that invoked the method.)
SignalR can work behind a load balancer. It just requires a little more setup so all the SignalR servers can communicate with each other via a backplane such as Service Bus or Redis. This allows messages to get dispatched to the server that owns the server-to-client connection.
https://github.com/SignalR/SignalR/wiki/Azure-service-bus details how you can setup a Service Bus backplane on Azure.