#pragma once #include class UDPSocket final : public IPv4Socket { public: static NonnullRefPtr create(int protocol); virtual ~UDPSocket() override; static SocketHandle from_port(u16); static void for_each(Function); private: explicit UDPSocket(int protocol); virtual const char* class_name() const override { return "UDPSocket"; } static Lockable>& sockets_by_port(); virtual int protocol_receive(const KBuffer&, void* buffer, size_t buffer_size, int flags) override; virtual int protocol_send(const void*, int) override; virtual KResult protocol_connect(FileDescription&, ShouldBlock) override; virtual int protocol_allocate_local_port() override; virtual KResult protocol_bind() override; };