Main Site Documentation

Wanted: Stable network code


#1

I have been trying a dozen samples with basically the same 50 lines of network code with a few variations, they all look mostly the same but are missing some fundamental maturity.

If you fiddle around with the network cable, if you play for the wifi-router or your ISP changes DNS settings, you can have anyone of them throw a deadly exception.

I think the reason is the recent changes in the API’s and the inconsistent drivers provided.

I have been trying to hack some general handling and checking of states and availability, but have lost focus on my own project due to this. :frowning: (Gadgeteering should be fun!)

Does anyone have a stable set of networking code, that is easy to deploy into my playzone, making the networking layer stable.

Just to clarify, my networking code works fine, I am just nervous that I havent realized all possible exceptions to handle.


#2

@ njbuch - it is hard to write a generic network class which handles all error conditions. the exception mechanism provides a framework where the developer can tailor recovery to the application.

socket error recovery is a pain in the ankle. recognizing what actually happened comes from experience. for example, a return from a read with zero bytes read means the remote end disconnected. but if the remote end did not cleanly disconnect, then you could get an exception.

i feel your pain… every day. I have a c++ framework that I used for years, but it does nothing more than try to diagnose a problem, and report the problem via a callback.