Main Topics
Browse All TopicsCurrently I have an application that runs on our network. When someone logs on to the network it checks there system and gets the pc name. I would like to also get the IP address of that system. As well I may later like to ping that computer.
1) Is there a function to get the IP of this remote system?
2) IS the a function to ping a remote system and receive back the response?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
interesting link:
http://codeguru.earthweb.c
remove "http" string from URL
#include <Winsock2.h>
// do't forget to add WS2_32.LIB
// in your function
char szHostName[256];
char szIpAddress[256];
WSADATA wsaData;
HOSTENT *pHP;
SOCKADDR_IN myaddr;
myaddr.sin_family = AF_INET;
if ( SOCKET_ERROR != WSAStartup(0x202,&wsaData)
{
pHP = gethostbyname("www.google.
memcpy((char FAR *)&(myaddr.sin_addr), pHP->h_addr, pHP->h_length);
wsprintf(szIpAddress,"%d.%
WSACleanup();
}
Good Luck
Assuming your server app uses "SOCKET accept ( SOCKET s, struct sockaddr FAR* addr, int FAR* addrlen );" to accept connections from the clients you can get their ip address from the sockaddr.
e.g.
struct sockaddr_in sRecvSAddr;
int iRecvSize;
// iServerSocket is your listening socket
if( accept(iServerSocket, (struct sockaddr*)&sRecvSAddr, &iRecvSize) < 0 )
{
TRACE("Error");
}
else
{
unsigned int iIP = sServerConnectContainer.sR
}
......... if you're using CSocket or something else, just look for the sockaddr_in structure.
Business Accounts
Answer for Membership
by: GloomyFriarPosted on 2003-11-19 at 05:39:02ID: 9779147
gethostbyname
The gethostbyname function retrieves host information corresponding to a host name from a host database.
Note The gethostbyname function has been deprecated by the introduction of the getaddrinfo function. Developers creating Windows Sockets 2 applications are urged to use the getaddrinfo function instead of gethostbyname.
struct hostent FAR *gethostbyname(
const char FAR *name
);
Parameters
name
[in] Pointer to the null-terminated name of the host to resolve.
Return Values
If no error occurs, gethostbyname returns a pointer to the hostent structure described above. Otherwise, it returns a NULL pointer and a specific error number can be retrieved by calling WSAGetLastError.