Exemple #1
0
CAMLprim value
uwt_udp_set_broadcast_na(value o_udp, value o_b)
{
  HANDLE_INIT_NOUNINIT_NA(u, o_udp);
  int ret = uv_udp_set_broadcast((uv_udp_t*)u->handle,Long_val(o_b));
  return (VAL_UWT_UNIT_RESULT(ret));
}
Exemple #2
0
bool UDPSocket::setMulticastTTL(int ttl)
{
    assert(ttl > 0 && ttl < 255);
    if (!ptr())
        return false;
    return uv_udp_set_broadcast(ptr<uv_udp_t>(), ttl) == 0;
}
Exemple #3
0
Fichier : udp.c Projet : luvit/luv
static int luv_udp_set_broadcast(lua_State* L) {
    uv_udp_t* handle = luv_check_udp(L, 1);
    int on, ret;
    luaL_checktype(L, 2, LUA_TBOOLEAN);
    on = lua_toboolean(L, 2);
    ret =uv_udp_set_broadcast(handle, on);
    if (ret < 0) return luv_error(L, ret);
    lua_pushinteger(L, ret);
    return 1;
}
Exemple #4
0
/*
 * Class:     com_oracle_libuv_handles_UDPHandle
 * Method:    _set_broadcast
 * Signature: (JI)I
 */
JNIEXPORT jint JNICALL Java_com_oracle_libuv_handles_UDPHandle__1set_1broadcast
  (JNIEnv *env, jobject that, jlong udp, jint on) {

  assert(udp);
  uv_udp_t* handle = reinterpret_cast<uv_udp_t*>(udp);
  int r = uv_udp_set_broadcast(handle, on);
  if (r) {
    ThrowException(env, handle->loop, "uv_udp_set_broadcast");
  }
  return r;
}
Exemple #5
0
static int lluv_udp_set_broadcast(lua_State *L){
  lluv_handle_t  *handle = lluv_check_udp(L, 1, LLUV_FLAG_OPEN);
  int enable = lua_toboolean(L, 2);

  int err = uv_udp_set_broadcast(LLUV_H(handle, uv_udp_t), enable);
  if(err < 0){
    return lluv_fail(L, handle->flags, LLUV_ERR_UV, err, NULL);
  }

  lua_settop(L, 1);
  return 1;
}
Exemple #6
0
static PyObject *
UDP_func_set_broadcast(UDP *self, PyObject *args)
{
    int r;
    PyObject *enable;

    RAISE_IF_HANDLE_CLOSED(self, PyExc_HandleClosedError, NULL);

    if (!PyArg_ParseTuple(args, "O!:set_broadcast", &PyBool_Type, &enable)) {
        return NULL;
    }

    r = uv_udp_set_broadcast((uv_udp_t *)UV_HANDLE(self), (enable == Py_True) ? 1 : 0);
    if (r != 0) {
        RAISE_UV_EXCEPTION(UV_HANDLE_LOOP(self), PyExc_UDPError);
        return NULL;
    }

    Py_RETURN_NONE;
}
Exemple #7
0
static PyObject *
UDP_func_set_broadcast(UDP *self, PyObject *args)
{
    int err;
    PyObject *enable;

    RAISE_IF_HANDLE_NOT_INITIALIZED(self, NULL);
    RAISE_IF_HANDLE_CLOSED(self, PyExc_HandleClosedError, NULL);

    if (!PyArg_ParseTuple(args, "O!:set_broadcast", &PyBool_Type, &enable)) {
        return NULL;
    }

    err = uv_udp_set_broadcast(&self->udp_h, (enable == Py_True) ? 1 : 0);
    if (err < 0) {
        RAISE_UV_EXCEPTION(err, PyExc_UDPError);
        return NULL;
    }

    Py_RETURN_NONE;
}
bool UDPSocket::setMulticastLoop(bool flag)
{
    if (!ptr()) return false;
    return uv_udp_set_broadcast(ptr<uv_udp_t>(), flag ? 1 : 0) == 0;
}
Exemple #9
0
int  UvUdpSocket::setBroadcast(bool bOn)
{
	return uv_udp_set_broadcast(m_uv_udp, bOn?1:0);
}
Exemple #10
0
int melo_udp_set_broadcast(melo_udp_t * mudp, int on)
{
    return (uv_udp_set_broadcast(&mudp->uvudp, on) == 0 ? 1 : 0);
}
Exemple #11
0
extern "C" int
rust_uv_udp_set_broadcast
(uv_udp_t* handle, int on) {
    return uv_udp_set_broadcast(handle, on);
}