First of all, I know that in one topic there are several other threads, but I could not find anything in those that can help me, so I will try to be very specific with my situation.
I installed a simple UDP Client / UDP Server pair, which is responsible for transferring data between several parallel simulations. That is, each instance of the simulator works in a separate stream and sends data to the UDP socket. In the main thread, the server is running and routing messages between simulations.
(for this problem) important parts of the server code are as follows:
UDPServer::UDPServer(boost::asio::io_service &m_io_service) :
m_socket(m_io_service, udp::endpoint(udp::v4(), PORT_NUMBER)),
m_endpoint(boost::asio::ip::address::from_string("127.0.0.1"), PORT_NUMBER)
{
this->start_receive();
};
void UDPServer::start_receive() {
boost::asio::socket_base::reuse_address option(true);
this->m_socket.set_option(option);
this->m_socket.async_receive_from( boost::asio::buffer(this->recv_buffer),
this->m_endpoint,
boost::bind(&UDPServer::handle_receive, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
};
This works fine on my windows workstation.
; linux, node. , ,
bind: address already in use
1024 , . , , reuse_address, , .