From: Michael Tuexen <Michael.Tuexen@lurchi.franken.de>
Cc: guile-devel@gnu.org
Subject: Re: Initial SCTP support for the upcoming 1.6.5 release
Date: Fri, 20 Aug 2004 09:57:28 +0200 [thread overview]
Message-ID: <94FD6DA0-F27E-11D8-9417-000D932C78D8@lurchi.franken.de> (raw)
In-Reply-To: <87llgabohv.fsf@zip.com.au>
Kevin,
see my comments in-line.
Best regards
Michael
On Aug 20, 2004, at 3:13 AM, Kevin Ryde wrote:
> Michael Tuexen <Michael.Tuexen@lurchi.franken.de> writes:
>>
>> The argument, to use a function like getprotobyname
>> to perform a lookup in /etc/protocols, is not valid in my opinion.
>> The reason is, that besides I have not seen that, that the
>> constants above are defined in /usr/include/netinet/in.h and
>> are used.
>
> I don't want to go against the advice of the GNU/Linux man page. It's
> pretty explicit.
You are not going against it. You are not using them. You are only
providing constants available in /usr/include/netinet/in.h to
the guile user.
>
>> So if, a system (I do not know of any such system),
>> uses a different number for TCP, this number will not only be in
>> /etc/protocols, but also in /usr/include/netinet/in.h. A different
>> story are port numbers. They can (and should) be looked up in
>> /etc/services.
>> There are no constants describing the port number for an echo
>> server...
>
> Well I guess both protocol and service numbers for standard stuff are
> constants. I don't know why one reads a file instead of just putting
> numbers in a program. Maybe it dates right back to a time when such
> things were still in flux. Or maybe the theory is to avoid numbers
> hard coded in programs (though strings hard coded aren't much better
> :-).
You are right, both port numbers and protocol numbers are kind of
standardized. But there is two differences:
Normally a user of a program does not specify the transport protocol,
but the port (telnet 127.0.0.1 echo, for example). That is why you
need a translation service for these service names.
The second is that there are no predefined constants for port numbers
available on a system like it is for protocols.
I agree with the man page that it is bad to use
s = socket(AF_INET, SOCK_STREAM, 132);
It should be
s = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
because you are not using a number, you are using a constant.
So what is the difference if you use getprotocolbyname? You can move
the binaries to a different host which uses different numbers?
I have not seen that and I'm pretty sure that this is not in tune
with the socket() call.
BTW, for UDP and TCP the calls
s = socket(AF_INET, SOCK_DGRAM, 0);
s = socket(AF_INET, SOCK_STREAM, 0);
are used as acronyms for
s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
So I think the man page and reality match no pretty good for these
things,
but the man page seems to be pretty old (1995, on
http://www.freebsd.org/cgi/man.cgi?
query=protocols&apropos=0&sektion=0&manpath=Red+Hat+Linux%2Fi386+9&forma
t=html
Best regards
Michael
PS.: The usage of the third arg of the socket() call is the one
described
in the 3rd edition of Unix Network Programming, so I guess that
some
people will try to use it that way...
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2004-08-20 7:57 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-10 18:26 Initial SCTP support for the upcoming 1.6.5 release Michael Tuexen
2004-08-11 12:29 ` Michael Tuexen
2004-08-13 13:40 ` Marius Vollmer
2004-08-13 20:27 ` Michael Tuexen
2004-08-24 14:15 ` Marius Vollmer
2004-08-24 17:35 ` Michael Tuexen
2004-09-08 15:03 ` Marius Vollmer
2004-09-08 15:34 ` Michael Tuexen
2004-08-14 9:59 ` Michael Tuexen
2004-08-16 0:40 ` Kevin Ryde
2004-08-16 10:42 ` Michael Tuexen
2004-08-17 23:46 ` Kevin Ryde
2004-08-19 18:34 ` Michael Tuexen
2004-08-20 1:13 ` Kevin Ryde
2004-08-20 7:57 ` Michael Tuexen [this message]
2004-08-16 17:02 ` Michael Tuexen
2004-08-16 18:44 ` Rob Browning
2004-08-20 18:18 ` Michael Tuexen
2004-08-23 0:58 ` Kevin Ryde
2004-08-23 19:54 ` Michael Tuexen
2004-08-24 0:57 ` Kevin Ryde
2004-08-24 11:27 ` Michael Tuexen
2004-08-24 12:46 ` Michael Tuexen
2004-08-24 14:24 ` Marius Vollmer
2004-08-24 18:22 ` Michael Tuexen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=94FD6DA0-F27E-11D8-9417-000D932C78D8@lurchi.franken.de \
--to=michael.tuexen@lurchi.franken.de \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).