Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

implement uv_udp_set_multicast_ttl and uv_udp_set_broadcast on windows

  • Loading branch information...
Igor Zinkovsky
Igor Zinkovsky committed Jan 23, 2012
1 parent 497b1ec commit 726e36cf7c1daf8b1ecb2d46e1d5eee07b52c7a1
Showing with 21 additions and 0 deletions.
  1. +21 −0 src/win/udp.c
@@ -578,3 +578,24 @@ void uv_process_udp_send_req(uv_loop_t* loop, uv_udp_t* handle,
DECREASE_PENDING_REQ_COUNT(handle);
}


int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) {
if (setsockopt(handle->socket, IPPROTO_IP, IP_MULTICAST_TTL,
(const char*)&ttl, sizeof ttl) == -1) {
uv__set_sys_error(handle->loop, errno);
return -1;
}

return 0;
}


int uv_udp_set_broadcast(uv_udp_t* handle, int on) {
if (setsockopt(handle->socket, SOL_SOCKET, SO_BROADCAST, (const char*)&on,
sizeof on) == -1) {
uv__set_sys_error(handle->loop, errno);
return -1;
}

return 0;
}

0 comments on commit 726e36c

Please sign in to comment.
You can’t perform that action at this time.