Click here to Skip to main content
16,010,022 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionwhat api will allow me to 'spy' on internet objects Pin
SAK14-Jan-02 6:38
SAK14-Jan-02 6:38 
GeneralCPU performance Pin
Avneesh Bhatnagar14-Jan-02 6:27
Avneesh Bhatnagar14-Jan-02 6:27 
GeneralADO Data control! Pin
Mazdak14-Jan-02 4:48
Mazdak14-Jan-02 4:48 
GeneralRe: ADO Data control! Pin
Carlos Antollini14-Jan-02 5:10
Carlos Antollini14-Jan-02 5:10 
QuestionIs this realy possible? Pin
Rickard Andersson2014-Jan-02 4:44
Rickard Andersson2014-Jan-02 4:44 
AnswerRe: Is this realy possible? Pin
Joaquín M López Muñoz14-Jan-02 6:09
Joaquín M López Muñoz14-Jan-02 6:09 
GeneralRe: Is this realy possible? Pin
Rickard Andersson2014-Jan-02 9:47
Rickard Andersson2014-Jan-02 9:47 
GeneralRe: Is this realy possible? Pin
Joaquín M López Muñoz14-Jan-02 11:03
Joaquín M López Muñoz14-Jan-02 11:03 
OK... So if you're writting a client/server app, then you surely must be using Winsock under some form or another, aren't you? If you are not, then you have to initialize Winsock, as gethostbyname is a function within this library. See the Winsock Programmer's FAQ for details.
Now that you have WInsock properly initialized, all you have to do is call gethostbyname with the name of the server you want to resolve and extract the IP address from the return data. Something like this: (Warning: this has not even been compiled, typos expected)
CString strAddr; // where we'll store the IP
struct hostent *phe = gethostbyname(lpszServerName);
if(!phe||!phe->h_addr_list[0]){
  // gethotsbyname couldn't resolve the name
}
else{
  struct in_addr addr;
  memcpy(&addr,phe->h_addr_list[0],sizeof(addr));
  strAddr=inet_ntoa(addr);
}
Hope this helps.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralMFC hWnd pointers Pin
Steve Severance14-Jan-02 3:37
Steve Severance14-Jan-02 3:37 
GeneralRe: MFC hWnd pointers Pin
Jon Hulatt14-Jan-02 5:34
Jon Hulatt14-Jan-02 5:34 
GeneralRe: MFC hWnd pointers Pin
Steve Severance15-Jan-02 8:54
Steve Severance15-Jan-02 8:54 
GeneralRe: MFC hWnd pointers Pin
Jon Hulatt15-Jan-02 22:05
Jon Hulatt15-Jan-02 22:05 
GeneralRe: MFC hWnd pointers Pin
Nish Nishant15-Jan-02 22:30
sitebuilderNish Nishant15-Jan-02 22:30 
GeneralMessage handling/command routing Pin
Fredrik Skog14-Jan-02 3:08
Fredrik Skog14-Jan-02 3:08 
GeneralRe: Message handling/command routing Pin
Joaquín M López Muñoz14-Jan-02 3:18
Joaquín M López Muñoz14-Jan-02 3:18 
GeneralRe: Message handling/command routing Pin
Joaquín M López Muñoz14-Jan-02 3:28
Joaquín M López Muñoz14-Jan-02 3:28 
GeneralRe: Message handling/command routing Pin
Not Active14-Jan-02 4:15
mentorNot Active14-Jan-02 4:15 
GeneralRe: Message handling/command routing Pin
Fredrik Skog14-Jan-02 21:17
Fredrik Skog14-Jan-02 21:17 
GeneralRe: Message handling/command routing Pin
Nish Nishant14-Jan-02 21:47
sitebuilderNish Nishant14-Jan-02 21:47 
GeneralRe: Message handling/command routing Pin
Fredrik Skog14-Jan-02 22:42
Fredrik Skog14-Jan-02 22:42 
GeneralRe: Message handling/command routing Pin
Fredrik Skog15-Jan-02 1:37
Fredrik Skog15-Jan-02 1:37 
GeneralEdit other window control Pin
Mark Daniel13-Jan-02 22:37
Mark Daniel13-Jan-02 22:37 
GeneralRe: Edit other window control Pin
Rickard Andersson2014-Jan-02 2:46
Rickard Andersson2014-Jan-02 2:46 
GeneralRe: Edit other window control Pin
Mark Daniel15-Jan-02 22:10
Mark Daniel15-Jan-02 22:10 
GeneralRe: Edit other window control Pin
Rickard Andersson2016-Jan-02 1:56
Rickard Andersson2016-Jan-02 1:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.