2016-11-08 12:42:16 +00:00
|
|
|
|
|
|
|
/*
|
2016-11-08 14:53:52 +00:00
|
|
|
* flint.
|
2016-11-08 12:42:16 +00:00
|
|
|
*
|
|
|
|
* Cooperative multitasking engine.
|
|
|
|
*/
|
|
|
|
|
2016-11-08 14:53:52 +00:00
|
|
|
#include <flint_private.h>
|
|
|
|
#include <flint.h>
|
2016-11-08 12:42:16 +00:00
|
|
|
|
2016-11-08 14:53:52 +00:00
|
|
|
FLINT_API int
|
2016-11-08 12:42:16 +00:00
|
|
|
ft_bind(ftio_t iop, char *addr, int port)
|
|
|
|
{
|
|
|
|
ftio *io = iop;
|
|
|
|
struct sockaddr_in saddr;
|
|
|
|
int rc;
|
|
|
|
rc = uv_ip4_addr(addr, port, &saddr);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
rc = uv_tcp_bind(&io->handle, (struct sockaddr*)&saddr, 0);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
return 0;
|
|
|
|
}
|