// Don't forget to initialize the sockets DLL! char locn[255], locip[16]; gethostname(locn, 255); strcpy(locip , inet_ntoa(*(struct in_addr *)*gethostbyname(locn)->h_addr_list));