Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Sockets - WTF to be frank

Sockets - WTF to be frank

Sockets - WTF to be frank

OK, would anyone care to explain how to use sockets with perl?
I've treid... and treid, but it never works out the way it should... could someone give me a basic example of how to communicate with an SMTP server, please?

RE: Sockets - WTF to be frank

I have not done it myself and would rather give you a clear answer (not point you to yet another page), but, since no one else seems to be chiming in with any expertise........so............
I found this resource listed under 'communications' on www.perl.com. ; Hopefully, this will help.


There are examples of simple servers and clients on this page.

good luck.

 keep the rudder amid ship and beware the odd typo

RE: Sockets - WTF to be frank

heres an example... not a very good one, but an examle all the same.


use Socket;

$port = 25;
$server = "mail.unf.com";

socket(HANDLE, PF_INET, SOCK_STREAM, (getprotobyname('tcp'))[2]);

connect(HANDLE, pack('Sna4x8', AF_INET, $port, (gethostbyname($server))[4]);



you can then read or write to your socket just like any other file handle.

<HANDLE> to read;
print HANDLE to write;

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close