diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index d5da647bf..6d1d8f4f8 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1746,14 +1746,19 @@ void CClient::Run() // open socket { NETADDR BindAddr; - if(g_Config.m_Bindaddr[0] == 0 || net_host_lookup(g_Config.m_Bindaddr, &BindAddr, NETTYPE_ALL) != 0) + if(g_Config.m_Bindaddr[0] && net_host_lookup(g_Config.m_Bindaddr, &BindAddr, NETTYPE_ALL) == 0) + { + // got bindaddr + BindAddr.type = NETTYPE_ALL; + } + else { mem_zero(&BindAddr, sizeof(BindAddr)); BindAddr.type = NETTYPE_ALL; } if(!m_NetClient.Open(BindAddr, 0)) { - dbg_msg("client", "couldn't start network"); + dbg_msg("client", "couldn't open socket"); return; } } diff --git a/src/engine/client/serverbrowser.cpp b/src/engine/client/serverbrowser.cpp index 4dda9da98..588194ea9 100644 --- a/src/engine/client/serverbrowser.cpp +++ b/src/engine/client/serverbrowser.cpp @@ -495,7 +495,7 @@ void CServerBrowser::Refresh(int Type) /* do the broadcast version */ Packet.m_ClientID = -1; mem_zero(&Packet, sizeof(Packet)); - Packet.m_Address.type = NETTYPE_ALL|NETTYPE_LINK_BROADCAST; + Packet.m_Address.type = m_pNetClient->NetType()|NETTYPE_LINK_BROADCAST; Packet.m_Flags = NETSENDFLAG_CONNLESS; Packet.m_DataSize = sizeof(Buffer); Packet.m_pData = Buffer; diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 34eaddc44..704d4e378 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1270,6 +1270,7 @@ int CServer::Run() if(g_Config.m_Bindaddr[0] && net_host_lookup(g_Config.m_Bindaddr, &BindAddr, NETTYPE_ALL) == 0) { // sweet! + BindAddr.type = NETTYPE_ALL; BindAddr.port = g_Config.m_SvPort; } else diff --git a/src/engine/shared/econ.cpp b/src/engine/shared/econ.cpp index eb7df872f..e0df8635b 100644 --- a/src/engine/shared/econ.cpp +++ b/src/engine/shared/econ.cpp @@ -75,7 +75,11 @@ void CEcon::Init(IConsole *pConsole, CNetBan *pNetBan) NETADDR BindAddr; if(g_Config.m_EcBindaddr[0] && net_host_lookup(g_Config.m_EcBindaddr, &BindAddr, NETTYPE_ALL) == 0) + { + // got bindaddr + BindAddr.type = NETTYPE_ALL; BindAddr.port = g_Config.m_EcPort; + } else { mem_zero(&BindAddr, sizeof(BindAddr)); diff --git a/src/engine/shared/network.h b/src/engine/shared/network.h index dd43389ec..d633c3fc5 100644 --- a/src/engine/shared/network.h +++ b/src/engine/shared/network.h @@ -353,7 +353,7 @@ public: int ResetErrorString(); // error and state - int NetType() { return m_Socket.type; } + int NetType() const { return m_Socket.type; } int State(); int GotProblems(); const char *ErrorString(); diff --git a/src/mastersrv/mastersrv.cpp b/src/mastersrv/mastersrv.cpp index c88a9e78c..922577ca2 100644 --- a/src/mastersrv/mastersrv.cpp +++ b/src/mastersrv/mastersrv.cpp @@ -348,7 +348,11 @@ int main(int argc, const char **argv) // ignore_convention m_pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention if(g_Config.m_Bindaddr[0] && net_host_lookup(g_Config.m_Bindaddr, &BindAddr, NETTYPE_ALL) == 0) + { + // got bindaddr + BindAddr.type = NETTYPE_ALL; BindAddr.port = MASTERSERVER_PORT; + } else { mem_zero(&BindAddr, sizeof(BindAddr));