For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2005 > simple server app









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author simple server app
Peter Rabbitson

2005-03-29, 3:56 pm

Hi everyone, Here is my situation. I have a windows system which continuosly
runs a perl script, which utilizing Win32::Process and Win32::Setupsup is
controlling a windows only app and when triggered makes it spit export files
to a samba network share. From there on my main process which runs off a CGI
under linux uses those files for internal purposes and so on and so forth. I
would like to be able to trigger all exports remotely from the linux
machine. In order to do this I need to communicate 4 strings to the process
running on the windows machine. No information should be returned back,
except maybe a 0/1 flag signifying failure/completion. I looked into SOAP
and since I am not running apache or IIS or anything else on the windows box
for increased stability I started thinking about something like
SOAP::Transport::TCP (not much docs to look at unfortunately). It seems to
be able to do the job, however I feel it is an overkill for communicating 4
strings one way and 1 string the other way... I would appreciate if more
seasoned programmers share suggestions on how would they approach such a
problem (maybe there is something way simpler than SOAP that I simply do not
know about).

Thank you

Peter
Todd W

2005-03-29, 3:56 pm


"Peter Rabbitson" <rabbit@rabbit.us> wrote in message
news:20050329100443.GA28099@rabbit.us...
> Hi everyone, Here is my situation. I have a windows system which

continuosly
> runs a perl script, which utilizing Win32::Process and Win32::Setupsup is
> controlling a windows only app and when triggered makes it spit export

files
> to a samba network share. From there on my main process which runs off a

CGI
> under linux uses those files for internal purposes and so on and so forth.

I
> would like to be able to trigger all exports remotely from the linux
> machine. In order to do this I need to communicate 4 strings to the

process
> running on the windows machine. No information should be returned back,
> except maybe a 0/1 flag signifying failure/completion. I looked into SOAP
> and since I am not running apache or IIS or anything else on the windows

box
> for increased stability I started thinking about something like
> SOAP::Transport::TCP (not much docs to look at unfortunately). It seems to
> be able to do the job, however I feel it is an overkill for communicating

4
> strings one way and 1 string the other way... I would appreciate if more
> seasoned programmers share suggestions on how would they approach such a
> problem (maybe there is something way simpler than SOAP that I simply do

not
> know about).
>


In line with the SOAP approach, theres RPC-XML, a subset of SOAP. Its light
weight and would be easy to implement your specs in this method:

http://search.cpan.org/~rjray/RPC-XML-0.57/

It has a built in server called RPC::XML::Server. Theres also a RPC-XML
server that comes with SOAP-Lite. The difference between the two is the way
you define your network enabled functions.

If you need a book, try _Programming Web Services with Perl_ excellently
written and easy to read.

Todd W.


mgoland@optonline.net

2005-03-29, 3:56 pm



----- Original Message -----
From: Peter Rabbitson <rabbit@rabbit.us>
Date: Tuesday, March 29, 2005 5:04 am
Subject: simple server app

> Hi everyone,

Hello,

>Here is my situation. I have a windows system which
> continuoslyruns a perl script, which utilizing Win32::Process and
> Win32::Setupsup is
> controlling a windows only app and when triggered makes it spit
> export files
> to a samba network share. From there on my main process which runs
> off a CGI
> under linux uses those files for internal purposes and so on and
> so forth. I
> would like to be able to trigger all exports remotely from the linux
> machine. In order to do this I need to communicate 4 strings to
> the process
> running on the windows machine. No information should be returned
> back,except maybe a 0/1 flag signifying failure/completion. I
> looked into SOAP
> and since I am not running apache or IIS or anything else on the
> windows box
> for increased stability I started thinking about something like
> SOAP::Transport::TCP (not much docs to look at unfortunately). It
> seems to
> be able to do the job, however I feel it is an overkill for
> communicating 4
> strings one way and 1 string the other way... I would appreciate
> if more
> seasoned programmers share suggestions on how would they approach
> such a
> problem (maybe there is something way simpler than SOAP that I
> simply do not
> know about).

If it's just a bit of data exchange you can use a simple server to accomplish this task, and possibly build your own protocol for data exchange. Below is a simple server example.

#!PERL

use warnings;
use strict;
use IO::Socket::INET;
$|=1;
my $sock = IO::Socket::INET->new( Listen => 5,
LocalAddr => '127.0.0.1',
LocalPort => 9000,
Proto => 'tcp') or die "ERROR: $!\n";


if( my $session = $sock->accept() ){

print "connection from: ",$session->peerhost,"\n";
my $msg=<$session>;
print "Received: $msg";
}
else{
die "Error on Socket $!\n";
}


>
> Thank you

your welcome, hope it helps let us know if you have more issue's at hand.
Mar G.

>
> Peter
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com