diff options
author | schnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f> | 2005-06-01 17:10:43 +0000 |
---|---|---|
committer | schnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f> | 2005-06-01 17:10:43 +0000 |
commit | fdefec2e720d6cca3e79f098f3d262808ff28b51 (patch) | |
tree | 88ffa97d6965df4657f47c8bda71fc97d4c643ac /README | |
parent | 06b7208eb7043fbfbd28ef4b3e804f7b627ef370 (diff) |
Add suggestion for using perl to use sockets
git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@31 83718e91-0e4f-0410-abf4-91180603181f
Diffstat (limited to 'README')
-rw-r--r-- | README | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -20,6 +20,7 @@ put unique job IDs into all output files BSD tar: read files from file: -I filename tar: don't use -z; use tar and gzip +AIX: tar is GNU tar, but uses -L instead of -T IOUtil should not depend on anything (MoL should not depend on NaNChecker) @@ -46,3 +47,34 @@ output only if value has changed put stuff into namespace (move from C to C++?) rename "file", "storage" do something more unique + + + +Here is a suggestion for handling sockets in perl. +This is from "http://www.infocopter.com/perl/socket-server.htm". + +#!/usr/bin/perl -w +use strict; +################################################ +# Socket Client +# (c) retoh :) +################################################ +use Socket; + +my $host = 'localhost'; +my $port = 7890; + +my $proto = getprotobyname('tcp'); +socket(my $FS, PF_INET, SOCK_STREAM, $proto); +my $sin = sockaddr_in($port, inet_aton($host)); +connect($FS, $sin) || exit -1; + +my $old_fh = select($FS); $| = 1; select($old_fh); + +print $FS "Hello at ", scalar localtime(), "\n\n"; + +while(<$FS>) { + print; +} + +close $FS; |