I was wondering if its possible to control weather a port is open and listening or not using perl.

If it is possible to control ports with perl could someone give me a hand with it?

I've tried to find ways to do this but to no avail. I'm all googled out as of right now so I thought I would ask the perl monks while I had the chance today and hope I could get a positive response.

I'm wanting to create a program that will open a particular port. Then a program that will be able to connect to that port.
What I'm trying to do is sort of setup my own ftp server and client. I'm getting a new computer at some point and it would make life easier to transfer files like this. I know there are tons of ways out there to do this but I would like to code something to do it myself in perl.

If I can find a way to open/close ports using perl I could probably create a client and server program that would put that knowledge to use. Of course I would post it here on perl monks.

Is there anyone who could give me a hand?

I know that "re-inventing" the wheel isn't really useful to the community but is there anything wrong with wanting to know how a program does what it does?

I'm not looking for a program or direct solution to the above problem to be handed to me. Thats not what I am asking for. I want a little guidance so I can find my own way to do this.

In reply to Port control using perl? by jkm199

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.