| ... | @@ -1690,6 +1690,40 @@ pub fn getpeername(s: ws2_32.SOCKET, name: *ws2_32.sockaddr, namelen: *ws2_32.so | ... | @@ -1690,6 +1690,40 @@ pub fn getpeername(s: ws2_32.SOCKET, name: *ws2_32.sockaddr, namelen: *ws2_32.so |
| 1690 | return ws2_32.getpeername(s, name, @as(*i32, @ptrCast(namelen))); | 1690 | return ws2_32.getpeername(s, name, @as(*i32, @ptrCast(namelen))); |
| 1691 | } | 1691 | } |
| 1692 | | 1692 | |
| | 1693 | pub fn sendmsg( |
| | 1694 | s: ws2_32.SOCKET, |
| | 1695 | msg: *ws2_32.WSAMSG_const, |
| | 1696 | flags: u32, |
| | 1697 | ) i32 { |
| | 1698 | var bytes_send: DWORD = undefined; |
| | 1699 | if (ws2_32.WSASendMsg(s, msg, flags, &bytes_send, null, null) == ws2_32.SOCKET_ERROR) { |
| | 1700 | return ws2_32.SOCKET_ERROR; |
| | 1701 | } else { |
| | 1702 | return @as(i32, @as(u31, @intCast(bytes_send))); |
| | 1703 | } |
| | 1704 | } |
| | 1705 | |
| | 1706 | pub fn sendto(s: ws2_32.SOCKET, buf: [*]const u8, len: usize, flags: u32, to: ?*const ws2_32.sockaddr, to_len: ws2_32.socklen_t) i32 { |
| | 1707 | var buffer = ws2_32.WSABUF{ .len = @as(u31, @truncate(len)), .buf = @constCast(buf) }; |
| | 1708 | var bytes_send: DWORD = undefined; |
| | 1709 | if (ws2_32.WSASendTo(s, @as([*]ws2_32.WSABUF, @ptrCast(&buffer)), 1, &bytes_send, flags, to, @as(i32, @intCast(to_len)), null, null) == ws2_32.SOCKET_ERROR) { |
| | 1710 | return ws2_32.SOCKET_ERROR; |
| | 1711 | } else { |
| | 1712 | return @as(i32, @as(u31, @intCast(bytes_send))); |
| | 1713 | } |
| | 1714 | } |
| | 1715 | |
| | 1716 | pub fn recvfrom(s: ws2_32.SOCKET, buf: [*]u8, len: usize, flags: u32, from: ?*ws2_32.sockaddr, from_len: ?*ws2_32.socklen_t) i32 { |
| | 1717 | var buffer = ws2_32.WSABUF{ .len = @as(u31, @truncate(len)), .buf = buf }; |
| | 1718 | var bytes_received: DWORD = undefined; |
| | 1719 | var flags_inout = flags; |
| | 1720 | if (ws2_32.WSARecvFrom(s, @as([*]ws2_32.WSABUF, @ptrCast(&buffer)), 1, &bytes_received, &flags_inout, from, @as(?*i32, @ptrCast(from_len)), null, null) == ws2_32.SOCKET_ERROR) { |
| | 1721 | return ws2_32.SOCKET_ERROR; |
| | 1722 | } else { |
| | 1723 | return @as(i32, @as(u31, @intCast(bytes_received))); |
| | 1724 | } |
| | 1725 | } |
| | 1726 | |
| 1693 | pub fn poll(fds: [*]ws2_32.pollfd, n: c_ulong, timeout: i32) i32 { | 1727 | pub fn poll(fds: [*]ws2_32.pollfd, n: c_ulong, timeout: i32) i32 { |
| 1694 | return ws2_32.WSAPoll(fds, n, timeout); | 1728 | return ws2_32.WSAPoll(fds, n, timeout); |
| 1695 | } | 1729 | } |