同步操作将从 sulayman_tien/poco 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//// UDPClient.cpp//// Library: Net// Package: UDP// Module: UDPClient//// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.// and Contributors.//// SPDX-License-Identifier: BSL-1.0//#include "Poco/Net/UDPClient.h"#include "Poco/ErrorHandler.h"namespace Poco {namespace Net {UDPClient::UDPClient(const std::string& address, Poco::UInt16 port, bool listen):_address(address, port),_pThread(0),_stop(false){_socket.bind(SocketAddress(address, 0), true, true);_socket.setReuseAddress(true);_socket.setReusePort(true);_socket.connect(_address);_socket.setBlocking(true);if (listen){_pThread = new Thread;_pThread->start(*this);}}UDPClient::~UDPClient(){_stop = true;if (_pThread){_pThread->join();delete _pThread;}}void UDPClient::run(){Poco::Timespan span(250000);while (!_stop){if (_socket.poll(span, Socket::SELECT_READ)){try{char buffer[sizeof(Poco::UInt32)*2];int n = _socket.receiveBytes(buffer, sizeof(buffer));if (n >= sizeof(Poco::Int32)) handleResponse(buffer, n);}catch (Exception& exc){ErrorHandler::handle(exc);}catch (std::exception& exc){ErrorHandler::handle(exc);}catch (...){ErrorHandler::handle();}}}}int UDPClient::handleResponse(char* buffer, int length){Poco::Int32 count = *reinterpret_cast<Poco::Int32*>(buffer);if (count > 0) _dataBacklog = count;else if (count < 0) _errorBacklog = count;return count;}} } // namespace Poco::Net
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。