Main Site Documentation

Restart connection after Cerbuino has its network cable removed


#1

Hi,

I have some cerbuino’s in my network wich all connect to a central socket server over tcp/ip
every cerbuino has a unique fixed ip.

First I successfully setup my network with:

NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(Ethernet_CableConnectivityChanged);

ethernetInterface = new EthernetENC28J60(Microsoft.SPOT.Hardware.SPI.SPI_module.SPI1, Generic.GetPin(‘A’, 13), Generic.GetPin(‘A’, 14), Generic.GetPin(‘B’, 10));

ethernetInterface.NetworkInterface.EnableStaticIP(State.McSetting.IpAddress, State.McSetting.Subnet, State.McSetting.Gateway);

from that moment I can ping my cerbuino.

My cerbuino connects to the server, and reconnects after the connection is lost, perfect!

But! when the networkcable is pulled I do get a NetworkAvailabilityChanged event, and when I reinsert the cable I also get a NetworkAvailabilityChanged event.

But When I try to connect again, I keep getting a System.Net.Socket.SocketException.

Do I need to restart my network somehow? Any tips?


#2

@ dohmenict - Can you post a complete example that shows the issue?


#3

yes. but first let me try if updating the sdk from 4.3.3.0 to 4.3.6.0 helps… :-[


#4

@ dohmenict - It might, there were a lot of network improvements after 4.3.3.0.


#5

Update did the trick! 8)