Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17



Posted on 1999-10-06
Medium Priority
Last Modified: 2013-11-20
I have the name of a machine in our network, how to get the IP address of that machine.
Question by:Mohammed_maridi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

V_Bapat earned 20 total points
ID: 2102728
Use this function to get the ipaddress whether you provide the machine name or IP Address as a string format:

u_long CTelnetDlg::GetAddr(LPSTR szHost)
      LPHOSTENT lpstHost;
      u_long lAddr = INADDR_ANY;
      /* check that we have a string */
      if (*szHost)
            /* check for a dotted-IP address string */
            lAddr = inet_addr (szHost);
            /* If not an address, then try to resolve it as a hostname */
            if ((lAddr == INADDR_NONE) && (strcmp (szHost, "")))
                  lpstHost = gethostbyname(szHost);
                  if (lpstHost)
                  { /* success */
                        lAddr = *((u_long FAR *) (lpstHost->h_addr));
                  { /* failure */
                        lAddr = INADDR_ANY;  
      return (lAddr);


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

660 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