Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

server is numb?
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 ! $@\n";


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

Report this thread to moderator Post Follow-up to this message
Old Post
Christian Stalp
09-28-04 01:56 PM


Re: server is numb?
Okay okay, it shold call:
while ( $client = $server->accept () )
{
print "$client \n";
}
close ( $server );
__END_

And so it works, but not as I need. The output is
IO::Socket::INET=GLOB(0x81848d0)

Gruss Christian


--
Christian Stalp

Institut für Medizinische Biometrie, Epidemiologie und Informatik (IMBEI)
Obere Zahlbacher Straße 69
55131 Mainz
Tel.: 06131/ 17-6852

E-Mail: stalp@imbei.uni-mainz.de
Internet: www.imbei.de

Report this thread to moderator Post Follow-up to this message
Old Post
Christian Stalp
09-28-04 01:56 PM


Re: server is numb?
On Sep 28, Christian Stalp said:

>$socket-> send ( $data , $flags ) or die "could not send!\n";

To send data to the socket, just print() to it:

print $socket "$data\n";

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart


Report this thread to moderator Post Follow-up to this message
Old Post
Jeff 'japhy' Pinyan
09-28-04 01:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:31 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.