<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [Darknet](./bitburner.darknet.md) &gt; [connectToSession](./bitburner.darknet.connecttosession.md)

## Darknet.connectToSession() method

Attempts to connect to a target darkweb server that you have previously authenticated on. Unlike `authenticate`<!-- -->, connectToSession can be used to get a session on servers at any distance.

If successful, grants the script a session, allowing it to scp() files to that target. It also allows starting scripts with exec() on that target, if the target is directly connected to the server that the script is running on, or has a backdoor or stasis link.

If unsuccessful, more detail may be able to be gathered by using heartbleed() to look at the resulting logs on the server.

Note that the session granted is only for the current script instance (by PID) - other running scripts will need to use connectToSession with the correct password to also get a session with the target server.

**Signature:**

```typescript
connectToSession(host: string, password: string): DarknetResult;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

host


</td><td>

string


</td><td>

Hostname/IP of the target server to connect to existing session


</td></tr>
<tr><td>

password


</td><td>

string


</td><td>

The server's password, to verify the session


</td></tr>
</tbody></table>

**Returns:**

[DarknetResult](./bitburner.darknetresult.md)

A [DarknetResult](./bitburner.darknetresult.md) object

## Remarks

RAM cost: 0.05 GB

