Improving error handling for network connections

One programming interface for the construction of network connections is available as the function “connect”.
This API corresponds to software capabilities which are supported also by the programming language “C”.
Thus the following information is provided for the return value by the POSIX standard specification.

Upon successful completion, connect() shall return 0; otherwise, -1 shall be returned and errno set to indicate the error.

A hint for a failed connection attempt can only be indicated by a single error code after something happened.
I got the impression then that a better explanation of connection failures can not be directly supported by such an API design.

I imagine that an other API design can provide better explanations for known error situations.
Do you know any existing API alternatives? :\

No, not a single error code, the function returns: 0 = Success, -1 = Error. If it returns with -1 then errno is set to indicate the error, as shown in your own quoted code.

Now let’s not engage in some long drawn out cryptic thread, as it seems most threads started by yourself degenerate into. If you want to discuss improving error handling for network connections, there are far better places to do it. :wink:

As this is apparently about a programmer interface, it is about programming and will be moved to Development > Programming and Scripting.

Which communication interfaces would you prefer for the desired clarification of involved topics?

Did you ever read my earlier reply and did you understand it?

I had look at what is the source of the error as as was interested in the “after 8ms” and you did hit this error in libcurl
The network part of the Linux kernel is returning somehow EHOSTUNREACH

Let us know, the issue you opened.


and did you understand it?

Probably, yes.

As error codes were occasionally received for network connection attempts, more detailed error information was lost for sophisticated exception handling. :\

Do I really have to spell out everything??

If you think the error message should be improved, open an issue with libcurl or even better with the Linux kernel. I expect it will not be handled but you seem to be good in repeating question again and again so maybe you are lucky :sarcastic:

How do you think about to participate in the discussion for the topic “Extending the exception handling?”? :\

or even better with the Linux kernel.

I am curious how the support will evolve further also for adjusting system calls.

I expect it will not be handled

Do you find improvements in other (software) areas more desirable?

but you seem to be good in repeating question again and again so maybe you are lucky :sarcastic:

Some ideas need to be presented more often.