Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Network issue

Reply
Thread Tools

Network issue

 
 
Lepi
Guest
Posts: n/a
 
      09-27-2004
Hello

Please help...

I want to program a little client that sends something to a server, but
also reads an answer. What part of this code needs to be changed???

Also, is there a way to make a bidirectional communication, so if the
other side has something to say, my client can accept it without sending
a request??? How can I do that??

Thanks

use IO::Socket;
$adr=IO::Socket::INET->new(
Proto=>'tcp',
PeerAddr=>'localhost',
PeerPort=>'2332'
)
or die "Not good";

print("Input > ");
$in=<STDIN>;
print $adr $in;

 
Reply With Quote
 
 
 
 
Rhesa Rozendaal
Guest
Posts: n/a
 
      09-27-2004
Lepi wrote:
> Hello
>
> Please help...
>
> I want to program a little client that sends something to a server, but
> also reads an answer. What part of this code needs to be changed???
>
> Also, is there a way to make a bidirectional communication, so if the
> other side has something to say, my client can accept it without sending
> a request??? How can I do that??


Sockets are bidirectional.

> Thanks
>
> use IO::Socket;
> $adr=IO::Socket::INET->new(
> Proto=>'tcp',
> PeerAddr=>'localhost',
> PeerPort=>'2332'
> )
> or die "Not good";
>
> print("Input > ");
> $in=<STDIN>;
> print $adr $in;
>


$output = <$adr>;
or
$output = $adr->readline();
etc.

Suggested reading:

perldoc IO::Socket::INET
perldoc perlipc
perldoc IO::Socket
perldoc Socket

Rhesa
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it a hardware issue or a config issue or something else Scooty Cisco 0 06-14-2008 04:02 PM
Data Storage Issue (Basic Issue) Srini Java 11 06-01-2008 01:17 AM
Service Pack 2: login issue's and power management issue's ?!? Skybuck Flying Windows 64bit 0 04-07-2007 03:12 PM
inspiron 8200 video issue and hd issue the pez lover Computer Support 1 02-05-2007 02:44 AM
Major ActiveX Domain issue. NOT LOCAL PC ISSUE joe.valentine@gmail.com Computer Support 8 02-06-2006 09:03 PM



Advertisments