# Connection

Source: https://docs.interop.io/adapters/bloomberg/tapi-bridge/connection/index.html

## Connection

The Bloomberg Adapter will automatically search for and connect to the next available port if the default one is already occupied.

### Check Connection

To check whether the Bloomberg Adapter is connected to the Bloomberg Terminal, use the `"T42.BBG.IsLoggedIn"` method.

The `"T42.BBG.IsLoggedIn"` method doesn't accept any arguments and returns a Boolean value showing whether the Bloomberg Adapter is connected to the Bloomberg Terminal.

Example:

```javascript
const result = await io.interop.invoke("T42.BBG.IsLoggedIn");
const isConnected = result.returned.Result;
```

### Reconnect

To force reconnection of the Bloomberg Adapter to the Bloomberg Terminal, use the `"T42.BBG.Reconnect"` method.

The `"T42.BBG.Reconnect"` method doesn't accept any arguments and returns a Boolean value showing whether the Bloomberg Adapter has succeeded to reconnect to the Bloomberg Terminal.

Example:

```javascript
const result = await io.interop.invoke("T42.BBG.Reconnect");
const hasReconnected = result.returned.reconnected;
```
