Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
c5b8e55e
Commit
c5b8e55e
authored
Jul 22, 2016
by
Evelyn
Committed by
GitHub
Jul 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update mg_connect_opt.md
parent
559874fc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
mg_connect_opt.md
docs/c-api/net.h/mg_connect_opt.md
+10
-10
No files found.
docs/c-api/net.h/mg_connect_opt.md
View file @
c5b8e55e
...
@@ -8,11 +8,11 @@ signature: |
...
@@ -8,11 +8,11 @@ signature: |
struct mg_connect_opts opts);
struct mg_connect_opts opts);
---
---
Connect to a remote host.
Connect
s
to a remote host.
`address`
format is
`[PROTO://]HOST:PORT`
.
`PROTO`
could be
`tcp`
or
`udp`
.
The
`address`
format is
`[PROTO://]HOST:PORT`
.
`PROTO`
could be
`tcp`
or
`udp`
.
`HOST`
could be an IP address,
`HOST`
could be an IP address,
IPv6 address (if Mongoose is compiled with
`-DMG_ENABLE_IPV6`
)
,
or a host
IPv6 address (if Mongoose is compiled with
`-DMG_ENABLE_IPV6`
) or a host
name. If
`HOST`
is a name, Mongoose will resolve it asynchronously. Examples
name. If
`HOST`
is a name, Mongoose will resolve it asynchronously. Examples
of valid addresses:
`google.com:80`
,
`udp://1.2.3.4:53`
,
`10.0.0.1:443`
,
of valid addresses:
`google.com:80`
,
`udp://1.2.3.4:53`
,
`10.0.0.1:443`
,
`[::1]:80`
`[::1]:80`
...
@@ -20,18 +20,18 @@ of valid addresses: `google.com:80`, `udp://1.2.3.4:53`, `10.0.0.1:443`,
...
@@ -20,18 +20,18 @@ of valid addresses: `google.com:80`, `udp://1.2.3.4:53`, `10.0.0.1:443`,
See the
`mg_connect_opts`
structure for a description of the optional
See the
`mg_connect_opts`
structure for a description of the optional
parameters.
parameters.
Returns a new outbound connection
,
or
`NULL`
on error.
Returns a new outbound connection or
`NULL`
on error.
NOTE:
C
onnection remains owned by the manager, do not free().
NOTE:
The c
onnection remains owned by the manager, do not free().
NOTE: To enable IPv6 addresses
,
`-DMG_ENABLE_IPV6`
should be specified
NOTE: To enable IPv6 addresses
`-DMG_ENABLE_IPV6`
should be specified
in the compilation flags.
in the compilation flags.
NOTE:
New connection will receive
`MG_EV_CONNECT`
as it'
s first event
NOTE:
The new connection will receive
`MG_EV_CONNECT`
as it
s first event
which will report connect success status.
which will report
the
connect success status.
If
asynchronous resolution fail, or
`connect()`
syscall fail
for whatever
If
the asynchronous resolution fails or the
`connect()`
syscall fails
for whatever
reason (e.g. with
`ECONNREFUSED`
or
`ENETUNREACH`
), then
`MG_EV_CONNECT`
reason (e.g. with
`ECONNREFUSED`
or
`ENETUNREACH`
), then
`MG_EV_CONNECT`
event report failure. Code example below:
event
will
report failure. Code example below:
```
c
```
c
static
void
ev_handler
(
struct
mg_connection
*
nc
,
int
ev
,
void
*
ev_data
)
{
static
void
ev_handler
(
struct
mg_connection
*
nc
,
int
ev
,
void
*
ev_data
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment