Setting timeout when client tries to establish TCP connection to EMS server.

Setting timeout when client tries to establish TCP connection to EMS server.

book

Article ID: KB0091534

calendar_today

Updated On:

Products Versions
TIBCO Enterprise Message Service -
Not Applicable -

Description

Resolution:
Description:
=============

When client tries to establish TCP connection to EMS server, the timeout can take effect under the following situations if the server does not send a "RST" back to client.

Network is disconnected.
Server machine is down.
Server port (tcp or ssl) is blocked by firewall.

Resolution:
=============

1).  In C:

The EMS C client API (i.e tibemsConnectionFactory_CreateConnection) uses a non-block connect() call.  By default the timeout is 2 seconds.

For example, if the client is connecting to the server via URL "tcp://host1:port1,tcp://host1:port1", the call will return around 2+2+0.5+2+2=8.5 (seconds).

This timeout can be reset by tibemsConnectionFactory_SetConnectAttemptTimeout.

tibemsConnectionFactory_SetReconnectAttemptTimeout can also be used to set the timeout when the C client tries to reconnect to the server.


2). In Java:

The EMS Java client API uses Socket.connect(SocketAddress endpoint, int timeout).  By default the timeout is 3 seconds. You can set the timeout (in milliseconds) through the system property -Dtibco.tibjms.socket.connect.timeout.

com.tibco.tibjms.connect.atttempt.timeout or com.tibco.tibjms.reconnect.atttempt.timeout does not overwrite this parameter.

3). In .Net:

The timeout can be set by SetConnAttemptTimeout in ConnectionFactory in the EMS .Net API. When the above method is not used, the timeout depends on the TCP/IP setting in the registry on Windows.

TcpMaxDataRetransmissions
TCPInitialRtt

Refer to http://support.microsoft.com/kb/170359.

For examples, on Windows 7, one connection attempt to URL "tcp://host1:port1" could take 3+6+12=21 (seconds).

SetReconnAttemptTimeout can also be used to set the timeout when a .Net client tries to reconnect to the server.

Environment:
============
All

Keywords:
============
timeout socket

Issue/Introduction

Setting timeout when client tries to establish TCP connection to EMS server.