X
Xho Jingleheimerschmidt
Why are you unlinking them? What point does $node serve in the client?John said:I thought the code made it clear. What don't you understand about it?
Xho
Why are you unlinking them? What point does $node serve in the client?John said:I thought the code made it clear. What don't you understand about it?
Why are you unlinking them?
What point does $node serve in the client?
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.)
This can be confusing, and that's why I posted.
If I wanted to write an essay about some aspect of Perl usage, I would
open an account somewhere like blogger.com.
If I wanted to fill a gap in the Perl docs or FAQ, I would draft a
revised FAQ entry or revised doc section and submit it to the relevant
maintainers. I'd expect to have to rewrite it once or twice if asked. I
would set my expectations minimally.
If I wanted to make some sort of helpful announcement in CLPM I'd say so
in the subject, or at least at the top of the posting. (Obviously there
is a certain amount of hindsight here, but I like to think I would
probably have done this anyway).
I would try to remember that gifts should not be conditional on the
recipients' gratitude or even appreciation.
If I was tempted to engage in, or continue, an acrimonious argument, I'd
go for a walk in the park, until the temptation faded away†.
As may be evident, in my case the above are somewhat aspirational.
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.
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.
Peter J. Holzer said: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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.