![]() |
GetInterfaces() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Public Function |
Declared in: Interfaces.h |
DeclarationBOOL GetInterfaces();
DescriptionRetreive the list of all the interfaces
Function Body
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)
See Also
This web site was generated
using Surveyor V4.50.811.1. Click
here
for more information. |
Site content copyright © 2001 Barak Weichselbaum. See the About page for additional notices. This page last updated: 27 Jun 2001. |