You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by hidayath <hi...@saventech.com> on 2013/08/07 12:12:15 UTC
Connection not Closed at TCP level
Hi,
We have a websocket application which keeps writing data to the clients.
We found that when tabs (not whole browser) of Firefox (ver. 22) is closed,
the websocket connection is not closed. Anyway, reproducibility is very low.
And the sendQ (netstat -an) keeps growing
So, what we did is. we kept sending heart beat from client. If this heart
beat timeout occurs, we are trying to close the connection as follows
ByteBuffer bbuff = ByteBuffer.allocate(1);
bbuff.put((byte) 0);
messageInbound.getWsOutbound().close(0, bbuff);
Is this correct approach to close the connection from server? Because, the
connection is not closed at lower level (netstat -an). Anyway, writing data
to it , is stopped and sendQ stops growing.
# netstat -an | grep :8080
tcp 0 402376 172.22.59.176:8080 198.162.18.207:64805
ESTABLISHED
Thanks and regards,
Hidayath
Re: Connection not Closed at TCP level
Posted by Mark Thomas <ma...@apache.org>.
On 07/08/2013 12:12, hidayath wrote:
> Hi,
>
>
>
> We have a websocket application which keeps writing data to the clients.
>
>
>
> We found that when tabs (not whole browser) of Firefox (ver. 22) is closed,
> the websocket connection is not closed. Anyway, reproducibility is very low.
> And the sendQ (netstat -an) keeps growing
>
>
>
> So, what we did is. we kept sending heart beat from client. If this heart
> beat timeout occurs, we are trying to close the connection as follows
>
> ByteBuffer bbuff = ByteBuffer.allocate(1);
>
> bbuff.put((byte) 0);
>
> messageInbound.getWsOutbound().close(0, bbuff);
>
>
>
> Is this correct approach to close the connection from server? Because, the
> connection is not closed at lower level (netstat -an). Anyway, writing data
> to it , is stopped and sendQ stops growing.
A ping from the server followed by a close if no pong is received within
a set timeout should be fine.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org