Skip to content

Instantly share code, notes, and snippets.

@rishid
Created November 21, 2014 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rishid/32e98f4f14d39f21a700 to your computer and use it in GitHub Desktop.
Save rishid/32e98f4f14d39f21a700 to your computer and use it in GitHub Desktop.
static void
on_connect_cb(uv_connect_t *request, int status)
{
conn_info *ci = (conn_info *)request->data;
if (status != 0)
{
printf("on connect status error %s %s\n",
uv_err_name(status),
uv_strerror(status));
struct sockaddr_in addr;
uv_ip4_addr("127.0.0.1", 5000, &addr);
// client_handle is a uv_tcp_t that was init'ed on first connect
uv_tcp_connect(request, &ci->client_handle, (struct sockaddr *)&addr, on_connect_cb);
return;
}
printf("connected status %d\n", status);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment