I'm a network engineer, meaning I build and support the infrastructure of my place of employment. I've not done this type of programming, but...

I implore you, don't take the easy or cheap way out. Do the networking stuff, properly! I've had to defend our network many, many, many times against programers who've not bothered to write the socket handling software correctly, then thought it was "the network's fault".

Tip 1: No, it's not ok to assume that you can create a connection and leave it up forever. We have to maintain the network, and failures can and do happen. You need to open the connection when you have traffic to send, and close it when you're done, then open it again when you have the next batch of stuff to send.

Tip 2: It's also not ok to assume that you'll never have to deal with a network failure. Most of the time the failure will be a failure to open the connection, but occasionally it will happen that you'll have to deal with the failure of an already open connection. Deal with those failures properly.

Tip 3: CPAN is your friend. There are lots of very smart people who've been down this road before, I'm sure there are modules on CPAN to make most of this pretty painless. Posting this question was also a good thing, I'm sure you'll find good examples of code from other monks who have experience doing this stuff.

I will thank you in advance for your Network Support group for your future attention to these details.

-Scott


In reply to Re: maintain tcp socket by 5mi11er
in thread maintain tcp socket by Anonymous Monk

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.