예제 #1
0
파일: udp.c 프로젝트: luvit/luv
static int luv_new_udp(lua_State* L) {
    uv_udp_t* handle = (uv_udp_t*)luv_newuserdata(L, sizeof(*handle));
    int ret;
    if (lua_isnoneornil(L, 1)) {
        ret = uv_udp_init(luv_loop(L), handle);
    }
    else {
        ret = uv_udp_init_ex(luv_loop(L), handle, lua_tointeger(L, 1));
    }
    if (ret < 0) {
        lua_pop(L, 1);
        return luv_error(L, ret);
    }
    handle->data = luv_setup_handle(L);
    return 1;
}
예제 #2
0
파일: udp.c 프로젝트: ajafff/node
int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) {
  return uv_udp_init_ex(loop, handle, AF_UNSPEC);
}