My server application uses RCF client callbacks. (I believe that in this case,
there is 2 TCP connection provided that I use TCP transport.)
sometimes, when the client calls server-side method, the server need to
disconnect the client (if the server decided to).
Is there anyway to forcefully disconnect the client from the server-side?
Thanks.
How to close(disconnect) client from the server side?
Re: How to close(disconnect) client from the server side?
If I add more,
I want, when the server decided to, the server need to forcefully disconnect the client so that
2 TCP connection should be released.
Thanks.
I want, when the server decided to, the server need to forcefully disconnect the client so that
2 TCP connection should be released.
Thanks.
Re: How to close(disconnect) client from the server side?
There is only ever a single TCP connection associated with a RcfClient<> object. If you have two TCP connections in play, I assume you have a RcfClient<> on the client side, for client-to-server calls, and a RcfClient<> on the server side, for server-to-client calls. The two connections are managed separately, and you can close either one without affecting the other.
If from the server side you want to close both, in response to a remote call from the client, then first off you should find the relevant server-side RcfClient<> object and close that, and then you can close the connection the remote call came in on, by calling:
RCF::getCurrentSession().setCloseSessionAfterWrite(true);
, which will close the TCP connection after the response has been sent.
Alternatively you could send a response back to the client, instructing it to close the connection.
If from the server side you want to close both, in response to a remote call from the client, then first off you should find the relevant server-side RcfClient<> object and close that, and then you can close the connection the remote call came in on, by calling:
RCF::getCurrentSession().setCloseSessionAfterWrite(true);
, which will close the TCP connection after the response has been sent.
Alternatively you could send a response back to the client, instructing it to close the connection.