On my FEZ Cobra II Net I have problems handling incoming socket connections. I have ported the code I used on my 4.2 setup but the above call was no longer available and can't find any substitute. It looks like it is still needs because my webserver is listening but no incoming connections are accepted.
I played around with the Network availability by connection/disconnecting the network cable.
I’m using a G120 custom board with ENC28 (FW 4.3 beta 2)
I get the NetworkChange.NetworkAvailabilityChanged event when I disconnect the network cable, but EthernetENC28J60.NetworkAvailable stays true (which sould be named “IsNetworkAvailable” btw.).
eth = new GHI.Networking.EthernetENC28J60(SPI.SPI_module.SPI2, GHI.Pins.G120.P1_10, GHI.Pins.G120.P2_11, GHI.Pins.G120.P1_9, 4000);
// eth. .NetworkAddressChanged += Interface_NetworkAddressChanged;
if (!eth.Opened)
eth.Open();
eth.NetworkInterface.EnableStaticIP("192.168.1.204", "255.255.255.0", "192.168.1.1");
Thread myWebServer = new Thread(webServer);
myWebServer.Start();
And I have a webserver:
private static void webServer()
{
const Int32 c_port = 2521; // 80;
// Create a socket, bind it to the server's port, and listen for client
// connections.
Socket server = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, c_port);
server.Bind(localEndPoint);
server.Listen(Int32.MaxValue);
while (true)
{
try
{
// Wait for a client to connect.
Socket clientSocket = server.Accept();
// Process the client request. true means asynchronous.
new ProcessClientRequest(clientSocket, true);
}
catch
{
}
}
}
server.Accept never returns. I am able to ping the device though so something is working.
@ Reinhard Ostermeier and T_Langholen - AssignNetworkingStackTo no longer exists. It is now handled internally. NetworkAvailable should now properly be set to false when applicable. Additionally, its name was changed to NetworkIsAvailable in the next beta.