Skip to Content.
Sympa Menu

transport - Re: [transport] API comments

Subject: Transport protocols and bulk file transfer

List archive

Re: [transport] API comments


Chronological Thread 
  • From: stanislav shalunov <>
  • To:
  • Subject: Re: [transport] API comments
  • Date: 24 Feb 2005 23:43:34 -0500

Yunhong Gu
<>
writes:

> int x_sockerror(X_SOCKET skt)
>
> I think the parameter "skt" is not very useful because the error is
> always checked right after a socket function is called. For example,
> on *nix "errno" is used

But in C, ``int ferror(FILE *stream)'', ``int feof(FILE *stream)'' is
a per-object error checking. The advantage is that is the programmer
is not sufficiently meticulous about error checking, errors could
still, sometimes, be caught---with subsequent error checks.

Having a per-socket error state looks like a tradeoff to me: the
socket structure is larger, but this somewhat compensates for the lack
of a native exception mechanism in C (not fully, of course). Given
that a typical socket might have quite a bit of buffer space
associated with it, I'd expect that the extra space to keep an error
code to be negligible.

What should x_sockerror() return, though? Shall we need a list of
error codes at some later point, or can we get by with errno.h? (This
is mostly independent of whether the function takes an argument.)

--
Stanislav Shalunov http://www.internet2.edu/~shalunov/

Letters in this message are closer than they appear.



Archive powered by MHonArc 2.6.16.

Top of Page