Allow usbgecko to try a range of ports, such that multiple dolphin instances will setup their servers on consecutive ports starting at 55020.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6877 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman
2011-01-19 02:17:11 +00:00
parent b1c6f959d9
commit afebc0d1d3
3 changed files with 20 additions and 5 deletions

View File

@ -488,14 +488,18 @@ void SocketTCP::Create(SocketHelper::SocketType Descriptor)
// Setup default options
if (IsValid())
{
/* We must disable this in order to detect if ports are being used by other apps, or
other instances of dolphin. This is also disabled in SFML 2.0, see
http://www.sfml-dev.org/forum/viewtopic.php?t=3388
// To avoid the "Address already in use" error message when trying to bind to the same port
int Yes = 1;
if (setsockopt(mySocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char*>(&Yes), sizeof(Yes)) == -1)
{
std::cerr << "Failed to set socket option \"SO_REUSEADDR\" ; "
<< "binding to a same port may fail if too fast" << std::endl;
}
*/
int Yes = 1;
// Disable the Nagle algorithm (ie. removes buffering of TCP packets)
if (setsockopt(mySocket, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char*>(&Yes), sizeof(Yes)) == -1)
{