How to know if a network adapter is connected



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.


.



Relevant Pages

  • Broadband - ping and net view doesnt work on own machine
    ... I've run into a strange problem with my broadband connection (NTL ... DHCP server and this appears to work fine. ... I have a National Semiconductor Gigabyte card ... Could it be a hardware problem with my network card? ...
    (microsoft.public.windowsxp.network_web)
  • Re: WAP54Gs with WPA not handing out IPs from SBS2003 server
    ... Do you have enough IP addresses in the DHCP pool on the DHCP server? ... There's not even 50 machines total on the network. ... I'll assume you're running Windoze XP Home using Wireless Zero Config ... With the PCMCIA card, it's the WZC software. ...
    (alt.internet.wireless)
  • Re: WAP54Gs with WPA not handing out IPs from SBS2003 server
    ... Do you have enough IP addresses in the DHCP pool on the DHCP server? ... There's not even 50 machines total on the network. ... I'll assume you're running Windoze XP Home using Wireless Zero Config ... With the PCMCIA card, it's the WZC software. ...
    (alt.internet.wireless)
  • Laptop DHCP problems
    ... Are PCMCIA network cards different some how? ... I have a laptop, I have a DHCP server, in tty12 I display all the log ... have one PCMCIA card so I can't test if it is the card or not. ...
    (alt.os.linux)
  • Re: 2003 Server Standard Edition DHCP Server problems
    ... should change the sequence of network connections to be used for network ... Once the above is done, when you restart the DHCP Server service, DHCP ... > other card configured with a static ip address of 192.168.0.1. ...
    (microsoft.public.win2000.networking)