![]() |
GetInterfaces() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Public Function |
Declared in: Interfaces.h |
BOOL GetInterfaces();
Retreive the list of all the interfaces
if (!m_iMaxInterfaces) { //structure not allocated ReportError("GetInterfaces","You constructed the class with 0 parameter!"); return FALSE; } try { //Allocate a socket SOCKET sok; sok=socket(AF_INET,SOCK_DGRAM,0); //Check it's valid if (sok==INVALID_SOCKET) { SetLastError("GetInterfaces"); return FALSE; } //Get the interface list unsigned long ulBytes; if (WSAIoctl(sok,SIO_GET_INTERFACE_LIST,NULL,NULL,m_pInfo, sizeof(INTERFACE_INFO)*m_iMaxInterfaces,&ulBytes,NULL,NULL)) { SetLastError("GetInterfaces"); //Close the socket closesocket(sok); return FALSE; } //Check how many structures we have m_iStructures=ulBytes/sizeof(INTERFACE_INFO); //Set our position to zero m_iPosition=0; //Close the socket closesocket(sok); return TRUE; } ERROR_HANDLER_RETURN("GetInterfaces",FALSE)
![]() |
Site content copyright © 2001 Barak Weichselbaum. See the About page for additional notices. This page last updated: 24 Apr 2001. |