[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Error 11001 when connecting PPC to PC via WiFi

Posted on 2006-05-04
4
Medium Priority
?
756 Views
Last Modified: 2013-12-27
I'm trying to make a simple chat application between a PPC (Dell Axim x51) and a PC (running Win2K).  When the PPC is connected with ActiveSync (169.254.2.2), it works flawlessly.  When I try to enter it through WiFi (192.168.1.101) it fails using both gethostbyname and gethostbyaddr.  For testing I'm using code taken/adapted from other answers in EE.  Here's my eVC 4 code:

void CCEConnectDlg::OnButton3()
{
      TCHAR szError[100];
      WSADATA wsa;
      struct hostent *pHostent;
      unsigned long ulAddr;
      WSACleanup();
      WSAStartup(MAKEWORD(1,1), &wsa);

      ulAddr = inet_addr("192.168.1.101");
      pHostent = gethostbyaddr((char *)&ulAddr, 4, AF_INET);
      if(pHostent == NULL)
      {
            wsprintf (szError, _T("gethostbyaddr(), \nError: %d"),WSAGetLastError ());
            MessageBox (szError, _T("Error"), MB_OK);
            WSACleanup();
            // try again using gethostbyname
            pHostent = gethostbyname("192.168.1.101");      // Specifying the server by its name;
            if(pHostent == NULL)
            {
                  wsprintf (szError, _T("gethostbyname(), \nError: %d"),WSAGetLastError ());
                  MessageBox (szError, _T("Error"), MB_OK);
            }
      }
      else
      {
            wsprintf (szError, _T("It worked!!! Name: %s"),pHostent->h_name);
            MessageBox (szError, _T("Success"), MB_OK);
      }
      WSACleanup();
      return;      
}

Using 192.168.1.101 ALWAYS results in error 11001, which is WSAHOST_NOT_FOUND.  Can anyone tell me how to make this work?

Thanks,
Paul
0
Comment
Question by:prstein
  • 2
  • 2
4 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 16613799
When your connected via wifi can you ping another local address?
0
 
LVL 1

Author Comment

by:prstein
ID: 16623661
<Sorry for the delay...>

I downloaded "z2 PocketLAN 3.11", and it appears that I can successfully ping it

Best Regards,
Paul
0
 
LVL 48

Accepted Solution

by:
Mikal613 earned 1500 total points
ID: 16638436
if not mistaken gethostbyaddr is looking for a DNS which means in your host file you have a line which returns a Ip from a string. What you want to accomplish is not possible. Your DNS is not setup.
0
 
LVL 1

Author Comment

by:prstein
ID: 16648780
Doh!!!

Instead of using gethostbyaddr I tried filling in a sockaddr_in structure manually.  It all works fine now.  Thanks!

Best Regards,

Paul
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month20 days, 2 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question