Fixed code to compile under windows.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1495 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2009-08-05 16:35:07 +00:00
parent 739216f2d2
commit 2dfb95ad13
2 changed files with 36 additions and 1 deletions

View File

@ -180,7 +180,14 @@ int pqissllistenbase::setuplisten()
{
int on = 1;
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
#ifndef WINDOWS_SYS // ie UNIX
if (setsockopt(lsock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
#else //WINDOWS_SYS
if (setsockopt(lsock, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(on)) < 0)
#endif
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
{
std::ostringstream out;
out << "pqissllistenbase::setuplisten()";

View File

@ -198,6 +198,28 @@ int main(int argc, char **argv)
}
#ifndef WINDOWS_SYS
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
#else
// Windows Networking Init.
WORD wVerReq = MAKEWORD(2,2);
WSADATA wsaData;
if (0 != WSAStartup(wVerReq, &wsaData))
{
std::cerr << "Failed to Startup Windows Networking";
std::cerr << std::endl;
}
else
{
std::cerr << "Started Windows Networking";
std::cerr << std::endl;
}
#endif
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
std::string ownId = "OWNID";
/* create a dummy auth mgr */
@ -241,8 +263,14 @@ int main(int argc, char **argv)
connMgr->tick();
setupTest(i, connMgr);
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
#ifndef WINDOWS_SYS // ie UNIX
sleep(1);
#else
Sleep(1000);
#endif
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
connMgr->tick();
checkResults(i, connMgr);