Most probably, this is a FAQ or RTFM like question. Unfortunately, I did RTFM and I did Super Search but I did not found similar problems.
I'm trying to write a small pop3 proxy server which needs to take away spam mail between the real pop3 server and my mail client.
To achieve this, I'm now writing just a little test server, which I connect to using just a telnet connection. I can send things to the server but the server seems unable to talk back.
ActivePerl 5.6.1 on Windows 98 Second Edition
Update: Oh yeah, there's no firewall blocking server response, because I've written a similar server program in Visual Basic and that one works.
The code:
# just the basics
use strict;
use warnings;
use Socket;
# start up the server
socket (SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1);
# My book says to use inet_aton($host)
# that would be inet_aton('localhost')
# but inet_aton seems to return v127.0.0.1 so I prefer to use that
my $addr = sockaddr_in(110, v127.0.0.1);
bind(SERVER, $addr) or die "Could not bind to port";
listen(SERVER, SOMAXCONN) or die "Could nit listen to port";
my $lines = 0; # how many lines are sent by the client
my $line; # current line
accept(CLIENT, SERVER);
# just to be sure:
binmode CLIENT;
binmode SERVER;
print "Nieuwe verbinding...\n"; # Dutch for 'new connection'
# new connection? Send something to client
print CLIENT "+OK\n";
# ... code goes on, but the above line seems never sended to the clien
+t.
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.