mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 14:40:18 +00:00
LibCore: Implement UDPServer on Windows
This commit is contained in:
parent
cc3cabc768
commit
904f736b95
Notes:
github-actions[bot]
2025-08-07 02:26:21 +00:00
Author: https://github.com/ayeteadoe
Commit: 904f736b95
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5435
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/R-Goc
3 changed files with 114 additions and 1 deletions
|
@ -270,6 +270,22 @@ ErrorOr<int> accept(int sockfd, struct sockaddr* addr, socklen_t* addr_size)
|
|||
return fd;
|
||||
}
|
||||
|
||||
ErrorOr<ssize_t> sendto(int sockfd, void const* source, size_t source_length, int flags, struct sockaddr const* destination, socklen_t destination_length)
|
||||
{
|
||||
auto sent = ::sendto(sockfd, static_cast<char const*>(source), source_length, flags, destination, destination_length);
|
||||
if (sent == SOCKET_ERROR)
|
||||
return Error::from_windows_error();
|
||||
return sent;
|
||||
}
|
||||
|
||||
ErrorOr<ssize_t> recvfrom(int sockfd, void* buffer, size_t buffer_length, int flags, struct sockaddr* address, socklen_t* address_length)
|
||||
{
|
||||
auto received = ::recvfrom(sockfd, static_cast<char*>(buffer), buffer_length, flags, address, address_length);
|
||||
if (received == SOCKET_ERROR)
|
||||
return Error::from_windows_error();
|
||||
return received;
|
||||
}
|
||||
|
||||
ErrorOr<void> getsockname(int sockfd, struct sockaddr* name, socklen_t* name_size)
|
||||
{
|
||||
if (::getsockname(sockfd, name, name_size) == SOCKET_ERROR)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue