[En-Nut-Discussion] Detecting disconnet of the network cable
Eric Haver
havereric1 at gmail.com
Fri Jun 13 07:08:20 CEST 2008
Hi Joerg,
If you are using DHCP, you can try this:
Run a background thread that tries:
if (NutDnsGetHostByName("www.google.com")==0){
//probably cable is unplugged
printf("Can't resolve a URL")
}
*E
On Thu, Jun 12, 2008 at 8:20 AM, Wiegelmann, Jörg <
Joerg.Wiegelmann at ces-tronics.de> wrote:
> I'm using Ethernut with the EIR-SAM7 Hardware. I got data over a TCP-IP
> connection. When someone disconnects the network cable at the Ethernutboard,
> no softwarepart ist recognizing this. I tried the following implementation,
> but without success. tcperr doesn't show any error on disconnecting.
>
>
>
> NutTcpAccept(sockin, PortListen);
>
>
> NutTcpSetSockOpt(sockin,SO_RCVTIMEO,&ulReceiveTimeout,sizeof(ulReceiveTimeout));
>
> do
>
> {
>
> Cnt=NutTcpReceive(sockin,buffer,BUFFER_SIZE);
>
> tcperr = NutTcpError(sockin);
>
> }while(tcperr==0);
>
>
>
> any Idea?
>
> Best regards and thank you
>
> Joerg.
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
More information about the En-Nut-Discussion
mailing list