Connects a [[enet.host | host]] to a remote [[enet.host | host]]. Returns [[enet.peer | peer]] object associated with the remote [[enet.host | host]]. The actual connection will not take place until the next [[enet.host:service | host:service()]] is called, in which a "connect" [[enet.event | event]] will be generated.
== Function ==
=== Synopsis ===
<source lang="lua">
peer = host:connect(address, channel_count, data)
</source>
=== Arguments ===
{{param|string|address|The address to connect to in the format "ip:port".}}
{{param|number|channel_count|The number of channels to allocate. It should be the same as the channel count on the server. Defaults to 1.}}
{{param|number|data|An integer value that can be associated with the connect [[enet.event | event]]. Defaults to 0.}}
=== Returns ===
{{param|enet.peer|peer|A [[enet.peer | peer]].}}

== See Also ==
* [[parent::lua-enet]]
* [[enet.event]]
* [[enet.peer]]
* [[enet.host:channel_limit]]
== Other Languages ==
{{i18n|enet.host:connect}}