From: John Kelly on
On Wed, 23 Jun 2010 20:09:20 -0700, Keith Keller
<kkeller-usenet(a)wombat.san-francisco.ca.us> wrote:

>On 2010-06-24, John Kelly <jak(a)isp2dial.com> wrote:
>> On Wed, 23 Jun 2010 19:27:41 -0700, Keith Keller
>><kkeller-usenet(a)wombat.san-francisco.ca.us> wrote:
>>
>>>Aren't you the same guy who posts repeatedly about the dh program

>> But why should that concern you, in this thread? Are you a troll too?
>
>It concerns me because people who engage in trollish behavior shouldn't
>be accusing others of trolling. But I certainly won't carry on the
>debate any further. (Or perhaps "take the bait" is more apt.)

Some people think anyone who says anything they don't like, is a troll.

I started this thread with useful material, but you bring up defamatory
posts from other ngs, completely unrelated to the topic.

See wikipedia for a definition of trolling.


--
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php

From: John Kelly on
On Thu, 24 Jun 2010 04:01:07 +0000, John Kelly <jak(a)isp2dial.com> wrote:

>>What point does $node serve in the client?

>This can be confusing, and that's why I posted.

Or at least one reason. Another is:

UNIX datagram sockets are not widely understood. The books that discuss
them usually leave them last, with little supporting material to explain
why they are so useful. Books tend to focus on stream sockets.

But for many applications of intra-server communications, stream sockets
are not needed, and are overkill. With stream sockets, you have to keep
track of all the connections, which means more work for the programmer.

Datagram sockets are easier because there are no connections. You just
use bind() to establish each node's address, and then, any node can talk
to any other node, at random. Because the kernel handles buffering for
you, UNIX datagram sockets are always reliable, and datagrams are always
delivered in order. So you never lose any packets.

UNIX datagram sockets are underrated. Once you understand the basic
code required, they're easy, and you can be a socket programmer without
a hard learning curve.

Perl helps too. You can throw some Perl scripts together and presto,
you have a socket application.

What's the point of tools anyway, if not to make work easier? You don't
need to be an expert to make effective use of tools.


--
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php

From: Peter J. Holzer on
On 2010-06-23 04:39, John Kelly <jak(a)isp2dial.com> wrote:
>
> Stein has an example of UNIX datagram sockets in his Networking book,
> but it includes other ideas that, to me, made it hard to see the forest
> for the trees. So I distilled it down to the bare essential elements
> related to socket setup.

I thought there should be lots of examples floating around on the web,
but they seem hard to find (maybe my Google-Fu is weak, or maybe nobody
uses Unix datagram sockets (I know I don't)). So I think your example is
useful.


> Please ignore bad practices in this code, it's only intended to show how
> to set up the datagram sockets, which to me, seemed mysterious without a
> simple example.
>
>
> --- CLIENT ---
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use IO::Socket::UNIX;
>
> my $peer = '/tmp/server.sock';
> my $node = '/tmp/client1.sock';
> unlink $node;
>
> my $sock = IO::Socket::UNIX->new (
> Local => $node,
> Peer => $peer,
> Type => SOCK_DGRAM
> ) or die "$!";

The usage of Local here does seem a bit mysterious. But since
the DGRAM service is connectionless it's clear that a different socket
is needed to receive the replies. If you had added a few comments
explaining stuff like that it would have been even more useful.

hp

From: John Kelly on
On Thu, 24 Jun 2010 16:17:10 +0200, "Peter J. Holzer"
<hjp-usenet2(a)hjp.at> wrote:

>> my $peer = '/tmp/server.sock';
>> my $node = '/tmp/client1.sock';
>> unlink $node;
>>
>> my $sock = IO::Socket::UNIX->new (
>> Local => $node,
>> Peer => $peer,
>> Type => SOCK_DGRAM
>> ) or die "$!";
>
>The usage of Local here does seem a bit mysterious. But since
>the DGRAM service is connectionless it's clear that a different socket
>is needed to receive the replies.

It's clear once you see the big picture. But when you're learning, and
swimming in details, it may not be so obvious.


>If you had added a few comments explaining stuff like that it would
>have been even more useful.

Agreed. I eventually got around to that, in subsequent posts. Maybe
that's not such a bad thing. The longer a post is, the fewer people who
will read it.



--
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php

From: Mart van de Wege on
"Peter J. Holzer" <hjp-usenet2(a)hjp.at> writes:

> On 2010-06-23 04:39, John Kelly <jak(a)isp2dial.com> wrote:
>>
>> Stein has an example of UNIX datagram sockets in his Networking book,
>> but it includes other ideas that, to me, made it hard to see the forest
>> for the trees. So I distilled it down to the bare essential elements
>> related to socket setup.
>
> I thought there should be lots of examples floating around on the web,
> but they seem hard to find (maybe my Google-Fu is weak, or maybe nobody
> uses Unix datagram sockets (I know I don't)). So I think your example is
> useful.

Try looking for 'Unix Domain Sockets'. The first hit of that + 'Perl'
gives an excerpt from the Perl Cookbook.

Mart

--
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.