From: Rick Jones on
Bill Cunningham <nospam(a)nspam.invalid> wrote:
> "Rainer Weikusat" <rweikusat(a)mssgmbh.com> wrote in message
> news:87y6h5k43x.fsf(a)fever.mssgmbh.com...

> > I tried to point out the difference between a declaration and an
> > operation.

> In your example you used 0 as the 3rd argument. Should I have
> done that? Or should I leave the port numbers the way they are?

As already mentioned, the third argument to socket() is not a port
number. The third argument is a specification of a *transport*
protocol - eg TCP, UDP, etc.

rick jones
and don't forget the error checking...

--
No need to believe in either side, or any side. There is no cause.
There's only yourself. The belief is in your own precision. - Joubert
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
From: Ersek, Laszlo on
On Fri, 2 Apr 2010, Rainer Weikusat wrote:

> the socket API itself is not tied to either protocol or address
> families.

That depends on what you consider to be part of the BSD sockets API.

In the end, you triggered me to follow up on this (originally I decided
not to, since my reply wouldn't have helped the OP):

On Fri, 2 Apr 2010, Rick Jones wrote:

> the protocol argument to the socket() call is to specify the transport
> protocol, not the service's port number in the transport protocol.

Additionally, the transport protocol may not even have a "port number"
concept. Or it may have a service identifier notion that is different from
the 16-bit port numbers used with TCP and UDP.

--o--

For example, SCTP could not be completely retrofitted to the BSD sockets
API. I'm looking at the sctp_bindx() and sctp_connectx() manuals shipped
with "lksctp-tools-1.0.11.tar.gz". Sure, with single local and remote
addresses, one can use bind() and connect(), but then "protocol
independent" excludes "multi-homing".

The address structures taken by these functions are, in case of IPv4,
"struct sockaddr_in" objects. If the SCTP designers had chosen different
service identifiers than 16-bit port numbers, then even sockaddr_in could
not have been used, as it includes a fixed member "sin_port" of type
"in_port_t" (an unsigned integer type of exactly 16 bits) for specifying
the service within the transport protocol. I guess "sin_port" was a
premature abstraction when the API was designed.

If you're implying getaddrinfo(), then I have to give it to you, it is
protocol and address family independent
<http://people.redhat.com/drepper/userapi-ipv6.html>. It is also one of
the hardest-to-use functions in the SUS, IMHO. And you still may need
sctp_connectx().

lacos
From: Rainer Weikusat on
scott(a)slp53.sl.home (Scott Lurndal) writes:
> Rainer Weikusat <rweikusat(a)mssgmbh.com> writes:
>>Doug McIntyre <merlyn(a)geeks.org> writes:
>>> "Bill Cunningham" <nospam(a)nspam.invalid> writes:
>>>>"Rick Jones" <rick.jones2(a)hp.com> wrote:
>>>
>>>>> Do definitely get either Unix Network Programming or some similar
>>>>> work. It will be invaluable.
>>>
>>>> I'm just afraid that it will talk only about AF_UNIX and not get into
>>>>internet networking. I understand there is a differenct in unix socket used
>>>>internally by the machine and internet communication.
>>>
>>> There's very little use of AF_UNIX compared to AF_INET in the real
>>> world,
>>
>>PF_UNIX sockets are the preferable method for IPC on a single
>>system. Also, the socket API itself is not tied to either protocol or
>>address families.
>
> preferable by whom?

People who understand IPC.
From: Ian Collins on
On 04/ 3/10 10:41 AM, Bill Cunningham wrote:
> "Ian Collins"<ian-news(a)hotmail.com> wrote in message
> news:81mvqdFsbU2(a)mid.individual.net...
>
>> Have you read the recommended books yet?
>
> Haven't look at it quite yet Ian but I intend too. As soon as I find the
> books.

While you wait, fix your clock!

--
Ian Collins
From: Bill Cunningham on

"Rick Jones" <rick.jones2(a)hp.com> wrote in message
news:hp5l44$vtc$1(a)usenet01.boi.hp.com...
> Bill Cunningham <nospam(a)nspam.invalid> wrote:
>> "Rick Jones" <rick.jones2(a)hp.com> wrote in message
>> news:hp5ejk$sm3$3(a)usenet01.boi.hp.com...
>
>> > Do definitely get either Unix Network Programming or some similar
>> > work. It will be invaluable.
>
>> I'm just afraid that it will talk only about AF_UNIX and not get
>> into internet networking. I understand there is a differenct in unix
>> socket used internally by the machine and internet communication.
>
> Do not let the title fool you "Unix Network Programming" spends a
> great deal of time on internet networking - perhaps more so than on
> AF_UNIX.
>
> http://www.amazon.com/Unix-Network-Programming-Sockets-Networking/dp/0131411551/ref=sr_1_1?ie=UTF8&s=books&qid=1270241419&sr=8-1
>
> This would probably make a good companion:
>
> http://www.amazon.com/Data-Computer-Communications-William-Stallings/dp/0132433109/ref=sr_1_1?ie=UTF8&s=books&qid=1270241586&sr=1-1
>
> rick jones
I just bought one by Kochans. Is it any good?

Bill