Commit 095d522f authored by jan.koester's avatar jan.koester
Browse files

test

parent 53b6f2ba
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -142,19 +142,23 @@ tcp::tcp(const std::string& addr, int port, int maxconnections, int sockopts)
}

void tcp::bind() {
    if (_Bound) return;
    if (::bind(_Socket, reinterpret_cast<sockaddr*>(&_Addr), _AddrLen) < 0) {
        NetException e;
        e[NetException::Error] << "tcp::bind failed: " << strerror(errno);
        throw e;
    }
    _Bound = true;
}

void tcp::listen() {
    if (_Listening) return;
    if (::listen(_Socket, _Maxconnections) < 0) {
        NetException e;
        e[NetException::Critical] << "tcp::listen failed: " << strerror(errno);
        throw e;
    }
    _Listening = true;
}

void tcp::setNonBlock() {
+3 −0
Original line number Diff line number Diff line
@@ -138,15 +138,18 @@ udp::udp(const std::string& uxsocket, int maxconnections, int sockopts)
}

void udp::bind() {
    if (_Bound) return;
    if (::bind(_Socket, reinterpret_cast<sockaddr*>(&_Addr), _AddrLen) < 0) {
        NetException e;
        e[NetException::Error] << "udp::bind failed: " << strerror(errno);
        throw e;
    }
    _Bound = true;
}

void udp::listen() {
    // UDP has no listen
    _Listening = true;
}

void udp::setNonBlock() {
+3 −0
Original line number Diff line number Diff line
@@ -239,6 +239,9 @@ namespace netplus {
		int              _Type;
		ULONG_PTR        _Extension;

		bool _Bound    = false;
		bool _Listening = false;

	protected:
		std::atomic<bool> _pendingIocpWrite{false};
		// ✅ legacy helper still available