Why does this simple Perl client not work?












2















I am using IPC with sockets.



I'm trying to understand why I cannot get this example script from perldoc perlipc to run on my Ubuntu setup:



#!/usr/bin/perl -w
use IO::Socket;
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => "daytime(13)",
)
|| die "can't connect to daytime service on localhost";

while (<$remote>) { print }


The script dies because the TCP client cannot be established.



Running $ less /etc/services shows me that daytime(13) is defined. What could be wrong here?










share|improve this question




















  • 1





    Renan's answer is correct. The example was added to the perl documentation in 1997, when the mood on the Internet was "services are cool! Let's run all of them!" and has only received minor cosmetic updates since then. It would be hard to write a modern version; there just aren't any universally available TCP ports with dead-simple protocols like "daytime" on them any more.

    – Alan Curry
    Jul 28 '12 at 1:47











  • What's your linux distribution ? If you don't have this service listening on localhost, how could you possibly connect to it.

    – daisy
    Sep 13 '12 at 1:49


















2















I am using IPC with sockets.



I'm trying to understand why I cannot get this example script from perldoc perlipc to run on my Ubuntu setup:



#!/usr/bin/perl -w
use IO::Socket;
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => "daytime(13)",
)
|| die "can't connect to daytime service on localhost";

while (<$remote>) { print }


The script dies because the TCP client cannot be established.



Running $ less /etc/services shows me that daytime(13) is defined. What could be wrong here?










share|improve this question




















  • 1





    Renan's answer is correct. The example was added to the perl documentation in 1997, when the mood on the Internet was "services are cool! Let's run all of them!" and has only received minor cosmetic updates since then. It would be hard to write a modern version; there just aren't any universally available TCP ports with dead-simple protocols like "daytime" on them any more.

    – Alan Curry
    Jul 28 '12 at 1:47











  • What's your linux distribution ? If you don't have this service listening on localhost, how could you possibly connect to it.

    – daisy
    Sep 13 '12 at 1:49
















2












2








2








I am using IPC with sockets.



I'm trying to understand why I cannot get this example script from perldoc perlipc to run on my Ubuntu setup:



#!/usr/bin/perl -w
use IO::Socket;
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => "daytime(13)",
)
|| die "can't connect to daytime service on localhost";

while (<$remote>) { print }


The script dies because the TCP client cannot be established.



Running $ less /etc/services shows me that daytime(13) is defined. What could be wrong here?










share|improve this question
















I am using IPC with sockets.



I'm trying to understand why I cannot get this example script from perldoc perlipc to run on my Ubuntu setup:



#!/usr/bin/perl -w
use IO::Socket;
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => "daytime(13)",
)
|| die "can't connect to daytime service on localhost";

while (<$remote>) { print }


The script dies because the TCP client cannot be established.



Running $ less /etc/services shows me that daytime(13) is defined. What could be wrong here?







perl tcp socket






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 6 at 21:28









Rui F Ribeiro

39.5k1479132




39.5k1479132










asked Jul 27 '12 at 21:05









ZaidZaid

3,729113033




3,729113033








  • 1





    Renan's answer is correct. The example was added to the perl documentation in 1997, when the mood on the Internet was "services are cool! Let's run all of them!" and has only received minor cosmetic updates since then. It would be hard to write a modern version; there just aren't any universally available TCP ports with dead-simple protocols like "daytime" on them any more.

    – Alan Curry
    Jul 28 '12 at 1:47











  • What's your linux distribution ? If you don't have this service listening on localhost, how could you possibly connect to it.

    – daisy
    Sep 13 '12 at 1:49
















  • 1





    Renan's answer is correct. The example was added to the perl documentation in 1997, when the mood on the Internet was "services are cool! Let's run all of them!" and has only received minor cosmetic updates since then. It would be hard to write a modern version; there just aren't any universally available TCP ports with dead-simple protocols like "daytime" on them any more.

    – Alan Curry
    Jul 28 '12 at 1:47











  • What's your linux distribution ? If you don't have this service listening on localhost, how could you possibly connect to it.

    – daisy
    Sep 13 '12 at 1:49










1




1





Renan's answer is correct. The example was added to the perl documentation in 1997, when the mood on the Internet was "services are cool! Let's run all of them!" and has only received minor cosmetic updates since then. It would be hard to write a modern version; there just aren't any universally available TCP ports with dead-simple protocols like "daytime" on them any more.

– Alan Curry
Jul 28 '12 at 1:47





Renan's answer is correct. The example was added to the perl documentation in 1997, when the mood on the Internet was "services are cool! Let's run all of them!" and has only received minor cosmetic updates since then. It would be hard to write a modern version; there just aren't any universally available TCP ports with dead-simple protocols like "daytime" on them any more.

– Alan Curry
Jul 28 '12 at 1:47













What's your linux distribution ? If you don't have this service listening on localhost, how could you possibly connect to it.

– daisy
Sep 13 '12 at 1:49







What's your linux distribution ? If you don't have this service listening on localhost, how could you possibly connect to it.

– daisy
Sep 13 '12 at 1:49












1 Answer
1






active

oldest

votes


















3














Are you running anything that provides a daytime service? From Wikipedia:




On UNIX-like operating systems a daytime server is usually built into the inetd (or xinetd) daemon. The service is usually not enabled by default. It may be enabled by adding the following lines to the file /etc/inetd.conf and telling inetd to reload its configuration.




 daytime   stream  tcp     nowait  root    internal
daytime dgram udp wait root internal


Thus you have to enable daytime service in the inetd.conf.






share|improve this answer
























  • I don't seem to have x?inetd.conf under /etc. Is there an alternative way to do this?

    – Zaid
    Jul 28 '12 at 7:36











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f44145%2fwhy-does-this-simple-perl-client-not-work%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














Are you running anything that provides a daytime service? From Wikipedia:




On UNIX-like operating systems a daytime server is usually built into the inetd (or xinetd) daemon. The service is usually not enabled by default. It may be enabled by adding the following lines to the file /etc/inetd.conf and telling inetd to reload its configuration.




 daytime   stream  tcp     nowait  root    internal
daytime dgram udp wait root internal


Thus you have to enable daytime service in the inetd.conf.






share|improve this answer
























  • I don't seem to have x?inetd.conf under /etc. Is there an alternative way to do this?

    – Zaid
    Jul 28 '12 at 7:36
















3














Are you running anything that provides a daytime service? From Wikipedia:




On UNIX-like operating systems a daytime server is usually built into the inetd (or xinetd) daemon. The service is usually not enabled by default. It may be enabled by adding the following lines to the file /etc/inetd.conf and telling inetd to reload its configuration.




 daytime   stream  tcp     nowait  root    internal
daytime dgram udp wait root internal


Thus you have to enable daytime service in the inetd.conf.






share|improve this answer
























  • I don't seem to have x?inetd.conf under /etc. Is there an alternative way to do this?

    – Zaid
    Jul 28 '12 at 7:36














3












3








3







Are you running anything that provides a daytime service? From Wikipedia:




On UNIX-like operating systems a daytime server is usually built into the inetd (or xinetd) daemon. The service is usually not enabled by default. It may be enabled by adding the following lines to the file /etc/inetd.conf and telling inetd to reload its configuration.




 daytime   stream  tcp     nowait  root    internal
daytime dgram udp wait root internal


Thus you have to enable daytime service in the inetd.conf.






share|improve this answer













Are you running anything that provides a daytime service? From Wikipedia:




On UNIX-like operating systems a daytime server is usually built into the inetd (or xinetd) daemon. The service is usually not enabled by default. It may be enabled by adding the following lines to the file /etc/inetd.conf and telling inetd to reload its configuration.




 daytime   stream  tcp     nowait  root    internal
daytime dgram udp wait root internal


Thus you have to enable daytime service in the inetd.conf.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jul 27 '12 at 21:22









RenanRenan

14.4k65377




14.4k65377













  • I don't seem to have x?inetd.conf under /etc. Is there an alternative way to do this?

    – Zaid
    Jul 28 '12 at 7:36



















  • I don't seem to have x?inetd.conf under /etc. Is there an alternative way to do this?

    – Zaid
    Jul 28 '12 at 7:36

















I don't seem to have x?inetd.conf under /etc. Is there an alternative way to do this?

– Zaid
Jul 28 '12 at 7:36





I don't seem to have x?inetd.conf under /etc. Is there an alternative way to do this?

– Zaid
Jul 28 '12 at 7:36


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f44145%2fwhy-does-this-simple-perl-client-not-work%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Morgemoulin

Scott Moir

Souastre