How to know if a network adapter is connected
- From: "fred_d" <duchassin@xxxxxxxxx>
- Date: Fri, 10 Oct 2008 09:00:37 +0200
Hello,
I'm writting this message because i 'm making a project using evc and
winsock.
In fact i use a dhcp server with two network card:
-one card is an ethernet card.
-the second is using USB rndis.
For my dhcp server i need to know the interface which is connected.
At the beginning, i use
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = INADDR_ANY;
addr.sin_port = htons(67);
if (SOCKET_ERROR == bind(sock, (LPSOCKADDR)&addr, sizeof(addr)))
{
ErrorMsg("Windows Sockets error %d: Couldn't bind thread socket.",
WSAGetLastError());
closesocket(sock);
return 0;
}
So after i'm waiting for receiving data:
while (!g_stopDHCP)
{
//if ((len=safe_recv(sock, buf, 548, 0, 1000))>0)
if ((len=recv(sock, buf, 548, 0))>0)
{
......
}
But i need to know which interface (the ethernet card or USB) is connected ?
I need to know that because the address that i give is different for each
connection.
Thanks to help me please.
F.
.
- Follow-Ups:
- Re: How to know if a network adapter is connected
- From: Helge Kruse
- Re: How to know if a network adapter is connected
- Prev by Date: GetDriveType
- Next by Date: Re: GetDriveType
- Previous by thread: GetDriveType
- Next by thread: Re: How to know if a network adapter is connected
- Index(es):
Relevant Pages
|