• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Nasluchiwanie na danym adresie

marian1

O RLY?
Joined
May 22, 2009
Messages
88
Reaction score
0
Jak zmusic ots do nasluchiwania tylko i wylacznie na danym adresie ip?
lsof | grep '*:7171' zwraca
t 10936 user 7u IPv4 169157 TCP *:7171 (LISTEN)
pomimo tego, ze w config.lua serwera mam:
-- Connection Config
ip = "adres"
port = "7171"

Uporal sie ktos z takim problemem?
 
Bo teraz serwer się wpycha na wszystkie adresy (INADDR_ANY), musiałbyś to obciąć w źródle do nasłuchiwania tylko na jednym adresie.

server.cpp, ServicePort::eek:pen
Code:
m_acceptor = new boost::asio::ip::tcp::acceptor(m_io_service, boost::asio::ip::tcp::endpoint(
boost::asio::ip::address(boost::asio::ip::address_v4(INADDR_ANY)), m_serverPort));

na mniej więcej:
Code:
m_acceptor = new boost::asio::ip::tcp::acceptor(m_io_service, boost::asio::ip::tcp::endpoint(
boost::asio::ip::address(boost::asio::ip::address_v4::from_string(g_config.getString(ConfigManager::IP))), m_serverPort));
 
Last edited:
Próbowałem kiedyś tak ale coś mi nie wychodziło. Ja rozwiązałem to tak:
Serv1 na porcie 9001
Serv2 na porcie 9002
Code:
iptables -A INPUT -p tcp -d $ip1--dport 9001 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -d $ip1 --dport 7171 -j DNAT --to-destination $ip1:9001
iptables -A INPUT -p tcp -d $ip2 --dport 9002 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -d $ip2 --dport 7171 -j DNAT --to-destination $ip2:9002
 
Próbowałem kiedyś tak ale coś mi nie wychodziło. Ja rozwiązałem to tak:
Serv1 na porcie 9001
Serv2 na porcie 9002
Code:
iptables -A INPUT -p tcp -d $ip1--dport 9001 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -d $ip1 --dport 7171 -j DNAT --to-destination $ip1:9001
iptables -A INPUT -p tcp -d $ip2 --dport 9002 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -d $ip2 --dport 7171 -j DNAT --to-destination $ip2:9002
też :)
 
Back
Top