So, while I'm asking questions... I have another project where I am working in a multi-threaded daemon. I have played around with Net::Daemon, Net::Server, IO::Socket, etc., and I'm becoming overwhelmed by the options, and experiencing analysis paralysis, and I'm hoping someone who has actually done some network programming could offer some advice.
So, what I want is a multi-threaded server that allows me to specify an output log file, and a listening port. The client will be netcat that connects to the server, and then I want to be able to echo commands to the netcat client (based on a list of commands I am putting in a seperate text file, so it could be changed at any time). I want to be able to capture all the output from the client to the configured log file (e.g. I send the command "ipconfig" or "set", I can send the output to a log file). It would need to append this file in case the daemon pukes and needs to be restarted (I dont want to clobber all my data).
Given that I want to send some things to a netcat listener, that has presented me with an unexpected challenge. My total lack of OOP experience is making all the modules for daemons and servers hard to understand. I know there are a numerous ways to do this, but what is best? IO::Socket and IO::Select? Net::Server? I can only find VERY limited examples of using these modules (like ONE for Net::Daemon that people have copied repeatedly from the Perl Cookbook). If I had some more examples to work from, it would help.
I'm sorry I didn't post any code, but I already feel stupid enough for not being able to grasp the OOP aspects of Perl, and I have made several tries (one of which seems to work, sort of, but for some reason won't print messages to STDOUT or any log files..) Net::Server seems most promising, but I'm still trying to figure out how to get it to use a config working from the docs.
Thank you again.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.