-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

On 05/07/2014 03:53 PM, Martin Sustrik wrote:
> 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);

You need to initialize your TCP handle first: uv_tcp_init(&server);

> 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] 
> <mailto:[email protected]>. To post to this group,
> send email to [email protected] 
> <mailto:[email protected]>. Visit this group at
> http://groups.google.com/group/libuv. For more options, visit
> https://groups.google.com/d/optout.


- -- 
Saúl Ibarra Corretgé
bettercallsaghul.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQIcBAEBAgAGBQJTajuHAAoJEEEOVVOum8BZxlMP/1PxDK8L3MvayDpEm5dJxWda
15vGqZLfLYciegIpuzIj6ZNvIQj9ksNQNhbpDt/+nwfsSU+4Lz9khHWmLEbiVIAY
jbuRowc5JCvd6pGtw5L19Nzzggxa261Io4HoPmFpChGChAL1rw6d1kNX9FNSTYFD
KWCd4lgc7lTPiJcLXGMIX/9CWmpjeSTEfbfmHcbheTMRv57eKcjY3bcNVbL49psm
KkId6hyCWfsUE5O/b2qSmxUesXmK8kPmazscYVt1PT6rDouC2+kyWRKvnALKGln6
0EM8YzvbBaW6TEfO+SOqXyPZ5AhLV21zwmEIdsbTLC3jzes4zRtixbew0JF2l7p8
J2AO2Iix+Nx2jLAQEDlw9Co2T5+YOSEQaXc66m+4WDEjwgFbLK73INqiM2fwgYx0
oGluiq1nktwQxdUrrrPGzdz421AebgAt2QR1frOgNwFY5sOXLf+CfK4AmInt8x4c
QEsuXzY1UZYVhcTmEme8l0q8wC+DvG6uQ+pdJvblVyotqo8xhdduyGRVVAsb7otv
jyu3LR50e2mhdcvnxDd6Rscsyghv77iBqxFa2YVlx8llZ+m0xI59W/+EN8sXeDXU
+dLNKjElT8kxuola4gnbnUQJ1otx9QTxob5mlR1W9FH5vco7hns9zwB7tSHo4rJA
dO+HkNaMDnwnYiXFHKBO
=yBfj
-----END PGP SIGNATURE-----

-- 
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.

Reply via email to