First off.. There is a module to deal with telnet access via perl (Net::Telnet I think). I didnt realize how much extra there is to telnet as opposed to a simple socket, but Ill show you one way of using a socket, and then leave finding the others ways as an excercise (Seeing as you are spending so much time with this :) ).... Basically I am treating the socket below just like any other filehandle
#!/usr/bin/perl
use IO::Socket;
$socket = IO::Socket->new(
PeerAddr => 'somehost_or_ip',
PeerPort => 'some_port',
Proto => 'tcp',
Type => SOCK_STREAM,
);
die "Cant connect to remote host!\n" if (!$socket);
# Send a transmission
print $socket "$some_output\n";
# Receive a resonse back
chomp($line = <$socket>);
Granted the above assumes a plaintext transmission, and there are more appropriate ways of playing with sockets, but this will get it done for you. As a test use that method to communicate with a mailserver (POP or SMTP), and get a feel for the transmission flow.
If you need your transmission encrypted just go to search.cpan.org and search for Crypt, or Digest, and that should get you rolling, and for compression network transmission or otherwise, I like Compess::Zlib.
have fun and happy hacking :)
/* And the Creator, against his better judgement, wrote man.c */
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.