[#i2p-sam-Session-Connect]
= xref:i2p.adoc[i2p]::xref:i2p/sam.adoc[sam]::xref:i2p/sam/Session.adoc[Session]::Connect
:relfileprefix: ../../../
:mrdocs:

Connect to an I2P peer&period;

== Synopsis

Declared in `&lt;i2p&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;requires&lowbar;capability(0x7f950e676a38), requires&lowbar;capability(0x7f9523034dc8), requires&lowbar;capability(0x7f950a507358), requires&lowbar;capability(0x7f950254a518), requires&lowbar;capability(0x7f950e7f8008), requires&lowbar;capability(0x7f94f89eb878), requires&lowbar;capability(0x7f95221006f8), requires&lowbar;capability(0x7f9522cbf4e8), requires&lowbar;capability(0x7f9503d5afb8), requires&lowbar;capability(0x7f9526afc668), requires&lowbar;capability(0x7f9502fbc858), requires&lowbar;capability(0x7f9521a2df58)&rsqb;&rsqb;
bool
Connect(
    xref:CService.adoc[CService] const& to,
    xref:i2p/Connection.adoc[Connection]& conn,
    bool& proxy&lowbar;error);
----

== Return Value

true on success

== Parameters

[cols="1,4"]
|===
| Name| Description
| *to* [in]
| Peer to connect to&period;
| *conn* [out]
| Established connection&period; Only set if `true` is returned&period;
| *proxy&lowbar;error* [out]
| If an error occurs due to proxy or general network failure, then this is set to `true`&period; If an error occurs due to unreachable peer (likely peer is down), then it is set to `false`&period; Only set if `false` is returned&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
