transport - Re: [transport] API comments
Subject: Transport protocols and bulk file transfer
List archive
- From: Yunhong Gu <>
- To: stanislav shalunov <>
- Cc:
- Subject: Re: [transport] API comments
- Date: Thu, 24 Feb 2005 23:14:11 -0600 (CST)
see this example:
X_SOCKET s = x_socket(AF_INET, SOCK_STREAM, 0);
if (INVALID_SOCK == s)
printf("error d%\n", x_sockerror(???)");
what socket id can you use here as a parameter of the above x_sockerror(),
since you don't even have a valid socket id yet.
another example is x_select(). The error of x_select() can be meaningless
for any particular sockets, i.e.:
if (-1 == x_select(...))
printf("error d%\n", x_sockerror(???)");
While you can use a special number like -1 to check such error
(e.g., x_sockerror(-1)), but this does not looks good :) and this still
need to be checked right after a socket function is called.
I was not concerning about the additional storage, I just thought if a
parameter is not very useful, adding it may bring possible trouble.
> 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.
If the programmer does not check the error right after a function call,
they, most likely, will not check it later :)
> 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.)
error code is ok. An integer code is convinient for programming. I am
afraid that for a user level implementation, error codes in errno.h may
not be sufficient.
In addition, a helper function can be used to print text error
information, just like perror.
Gu
- [transport] Proposed agenda for 2005-02-18 transport teleconference, stanislav shalunov, 02/17/2005
- Re: [transport] Proposed agenda for 2005-02-18 transport teleconference, Brian Tierney, 02/18/2005
- [transport] user-space overhead, stanislav shalunov, 02/21/2005
- [transport] Minutes for 2005-02-18 transport teleconference, stanislav shalunov, 02/21/2005
- API comments, Yunhong Gu, 02/24/2005
- Re: [transport] API comments, Steven Senger, 02/24/2005
- Re: [transport] API comments, stanislav shalunov, 02/24/2005
- Re: [transport] API comments, Yunhong Gu, 02/25/2005
- Re: [transport] API comments, stanislav shalunov, 02/25/2005
- Re: [transport] API comments, Yunhong Gu, 02/25/2005
- Re: [transport] API comments, stanislav shalunov, 02/25/2005
- Re: [transport] API comments, Yunhong Gu, 02/25/2005
- Re: [transport] API comments, stanislav shalunov, 02/25/2005
- Re: [transport] API comments, Yunhong Gu, 02/25/2005
- API comments, Yunhong Gu, 02/24/2005
- Re: [transport] Proposed agenda for 2005-02-18 transport teleconference, Brian Tierney, 02/18/2005
Archive powered by MHonArc 2.6.16.