Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Best way to write a socket server service in win32

by golemwashere (Acolyte)
on Apr 14, 2004 at 07:31 UTC ( [id://344948]=perlquestion: print w/replies, xml ) Need Help??

golemwashere has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I'm having trouble trying to use $server->accept() of IO::Socket module in a compiled service on win32.
I tried both PerlSvc from activestate and Win32::Daemon from Roth.
My simple socket service should just write on a file what gets on a socket.
The .pl and par compiled exe I wrote work great but I have real troubles producing a server out of that.
Could anyone suggest the best way to use server->accept and while ( <$client>) inside a windows service?
Thanks a lot
G
  • Comment on Best way to write a socket server service in win32

Replies are listed 'Best First'.
Re: Best way to write a socket server service in win32
by Jouke (Curate) on Apr 14, 2004 at 07:38 UTC
    I think we could really help you better if you showed us the code you tried (or an excerpt), and tell us what went wrong...


    Jouke Visser, Perl 'Adept'
    Using Perl to help the disabled: pVoice and pStory
      Yup 8)
      For example when I'm using PerlSvc and my startup sub is
      sub Startup { while(ContinueRun($delay)) { $server = IO::Socket::INET->new(LocalPort => $server_port, Type => SOCK_STREAM, Reuse => 1, Listen => 10 ) # or SOMAXCONN or die "Couldn't be a tcp server on port $server_port : $@\n"; while ($client = $server->accept()) { # $client is the new connection $client->autoflush(1); while ( <$client>) { $line=$_; open OUTPUT, ">>$logfile" or die "Cannot open $logfile :$!"; print OUTPUT $line; close OUTPUT; next; } } }
      the service starts but doesn't bin the socket (while in a standalone .exe it does )
      Thanks a lot G.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://344948]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found