# .connect (connect to a session)

### Command

> .connect

### Syntax

> .connect \[local]
>
> .connect \[Ip (string)] \[Port (decimal)]

### Description

Connects to a remote computer session or connects to a local debugger.

{% hint style="success" %}
If you don't specify the port, then **HyperDbg** uses the default port, which is **50000**; however, you can [change the default port](https://docs.hyperdbg.org/tips-and-tricks/misc/customize-build) if you compile the **HyperDbg**.
{% endhint %}

### Parameters

**\[local]**

The local debugging system.

**\[Ip (string)]**

The IP Address of the remote system.

**\[Port (decimal)] (optional)**

The port address that the remote debugger listens on.

### Examples

The following example connects to the current system for **local debugging**.

```
HyperDbg> .connect local
```

The following command connects to a remote system (**192.168.1.5**) which the **HyperDbg** debugger listens on its **50000** (by default) port.

```
HyperDbg> .connect 192.168.1.5
```

The following command connects to a remote system (**192.168.1.5**) which the HyperDbg debugger listens on its **50001** port.

```
HyperDbg> .connect 192.168.1.5 50001
```

### SDK

To connect to the local debugger in the [VMI Mode](https://docs.hyperdbg.org/using-hyperdbg/prerequisites/operation-modes#vmi-mode), you need to use the following function in `libhyperdbg`:

```clike
VOID
hyperdbg_u_connect_local_debugger();
```

To connect to the remote debugger in the [VMI Mode](https://docs.hyperdbg.org/using-hyperdbg/prerequisites/operation-modes#vmi-mode), you need to use the following function in `libhyperdbg`:

```clike
BOOLEAN
hyperdbg_u_connect_remote_debugger(const CHAR * ip, const CHAR * port);
```

### Remarks

1. In order to be able to load modules and run commands, you have to connect to a remote system or debug your current system.

### Requirements

None

### Related

[.disconnect (disconnect from a session)](https://docs.hyperdbg.org/commands/meta-commands/.disconnect)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyperdbg.org/commands/meta-commands/.connect.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
