Hi all,
Sorry for a newbie question, but I haven't found the answer in the docs:
I start listening for new TCP connections, however, at the moment nobody
tries to connect. The event loop sees no events and terminates immediately.
How can I prevent that?
My code follows:
#include <stdio.h>
#include <assert.h>
#include <uv.h>
uv_loop_t loop;
void on_new_connection(uv_stream_t *server, int status)
{
/* TODO */
assert (0);
}
int main()
{
int rc;
uv_tcp_t server;
loop = uv_default_loop();
struct sockaddr_in bind_addr = uv_ip4_addr("0.0.0.0", 7000);
uv_tcp_bind(&server, bind_addr);
rc = uv_listen((uv_stream_t*) &server, 128, on_new_connection);
assert (rc == 0);
rc = uv_run(&loop, UV_RUN_DEFAULT);
assert (rc == 0);
return 0;
}
Martin
--
You received this message because you are subscribed to the Google Groups
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.