Hello together,
I just tryed to make a simple Socket-Connection with a client and a server
which are connected with each other over localhost.
the server:
#!/usr/bin/perl
use IO::Socket;
use strict;
my $server_port = 3434;
my $server;
my $client;
my $in_line;
$server = IO::Socket::INET-> new ( LocalPort => $server_port,
Type => SOCK_STREAM,
Reuse => 1,
Listen => SOMAXCONN )
or die "unable to start server ! [EMAIL PROTECTED]";
while ( $client = $server->accept () )
{
$in_line = <CLIENT>;
print "$in_line \n";
}
close ( $server );
__END_
and the client:
#!/usr/bin/perl
use IO::Socket;
use strict;
my $remote_host = "localhost";
my $remote_port = 3434;
my $socket;
my $data = "test";
$socket = IO::Socket::INET->new ( PeerAddr => $remote_host,
PeerPort => $remote_port,
Proto => "tcp",
Type => SOCK_STREAM )
or die "unable to establishe a connection !\n";
$socket-> send ( $data , $flags ) or die "could not send!\n";
close ( $socket );
__END_
I expact, that the data-string is send by the client to the server. When it
reaches the server, the server put it out, and keep on listening.
But the server does nothing at all, its numb?!?
What did I omitted? How I get the flags? With fcntl ?
Gruss Christian
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>