Ported auto-discover LAN connect to win32

This commit is contained in:
Mark Vejvoda
2010-04-01 07:46:14 +00:00
parent 215fbdb33f
commit 6c92f188b6
13 changed files with 642 additions and 28 deletions

View File

@@ -87,7 +87,8 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
int ipIdx = 0;
while (myhostent->h_addr_list[ipIdx] != 0) {
sprintf(myhostaddr, "%s",inet_ntoa(*(struct in_addr *)myhostent->h_addr_list[ipIdx]));
printf("%s\n",myhostaddr);
//printf("%s\n",myhostaddr);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] myhostaddr = [%s]\n",__FILE__,__FUNCTION__,__LINE__,myhostaddr);
if(strlen(myhostaddr) > 0 && strncmp(myhostaddr,"127.",4) != 0) {
ipList.push_back(myhostaddr);
@@ -1035,7 +1036,10 @@ void BroadCastSocketThread::execute() {
try {
// Send this machine's host name and address in hostname:n.n.n.n format
sprintf(buff,"%s:%s",myhostname,ipList[0].c_str());
strcat(buff,myhostname);
for(int idx = 0; idx < ipList.size() ++idx) {
sprintf(buff,"%s:%s",buf,ipList[idx].c_str());
}
time_t elapsed = 0;
for( pn = 1; ; pn++ )