mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
LibCore: Add a timeout option to UDPSocket::connect
This allows us to set a timeout during connection and during receive and send operations. I didn't add this to the other connect calls as it's not used anywhere else for the time being.
This commit is contained in:
parent
a666140a68
commit
17d3592cab
2 changed files with 16 additions and 5 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <AK/Result.h>
|
||||
#include <AK/Span.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Time.h>
|
||||
#include <AK/Variant.h>
|
||||
#include <LibCore/Notifier.h>
|
||||
#include <LibCore/SocketAddress.h>
|
||||
|
@ -247,6 +248,7 @@ public:
|
|||
|
||||
ErrorOr<void> set_blocking(bool enabled);
|
||||
ErrorOr<void> set_close_on_exec(bool enabled);
|
||||
ErrorOr<void> set_receive_timeout(Time timeout);
|
||||
|
||||
void setup_notifier();
|
||||
RefPtr<Core::Notifier> notifier() { return m_notifier; }
|
||||
|
@ -321,8 +323,8 @@ private:
|
|||
|
||||
class UDPSocket final : public Socket {
|
||||
public:
|
||||
static ErrorOr<NonnullOwnPtr<UDPSocket>> connect(String const& host, u16 port);
|
||||
static ErrorOr<NonnullOwnPtr<UDPSocket>> connect(SocketAddress const& address);
|
||||
static ErrorOr<NonnullOwnPtr<UDPSocket>> connect(String const& host, u16 port, Optional<Time> timeout = {});
|
||||
static ErrorOr<NonnullOwnPtr<UDPSocket>> connect(SocketAddress const& address, Optional<Time> timeout = {});
|
||||
|
||||
UDPSocket(UDPSocket&& other)
|
||||
: Socket(static_cast<Socket&&>(other))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue