Something about function mg_connect #2435
-
Can I connect a tcp url with function mg_connect? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
It turns out to be the right url is |
Beta Was this translation helpful? Give feedback.
-
Please follow the guidelines in the documentation, examples and tutorials available. |
Beta Was this translation helpful? Give feedback.
Please follow the guidelines in the documentation, examples and tutorials available.
There is already an example on how to do what you want to do: https://mongoose.ws/documentation/tutorials/tcp/
Yours is a networking concepts problem.
localhost
means "resolve this address and use it", that is usually the loopback address;0.0.0.0
means "this host in this network" and in a listener context means "listen in all interfaces". You can't, of course, try to connect to that address because there is no way to resolve that,