Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing connection through timeout #84

Open
dmytrokarimov opened this issue Sep 29, 2014 · 1 comment
Open

Closing connection through timeout #84

dmytrokarimov opened this issue Sep 29, 2014 · 1 comment

Comments

@dmytrokarimov
Copy link

Hi.
Can you add support of closing connection after a period of inactivity

Here is the simple example what I want (class GelfTCPSender):

try {
    // reconnect if necessary or 5 min timeout occurred
    if (socket == null || os == null || lastSendTime + 5 * 60 * 1000 < System.currentTimeMillis()) {
        if (socket != null){
            socket.close();
        }
        socket = new Socket(host, port);
        os = socket.getOutputStream();
    }
    os.write(message.toTCPBuffer().array());
    lastSendTime = System.currentTimeMillis();

    return true;
} catch (IOException e) {
    // if an error occours, signal failure
    socket = null;
    return false;
}

I have some problems with firewall and keep-alive sessions.

@skorhone
Copy link

skorhone commented Sep 2, 2016

Would tcp keepalive resolve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants