Network issue

Discussion in 'Perl Misc' started by Lepi, Sep 27, 2004.

  1. Lepi

    Lepi Guest

    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;
     
    Lepi, Sep 27, 2004
    #1
    1. Advertisements

  2. 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
     
    Rhesa Rozendaal, Sep 27, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris
    Replies:
    1
    Views:
    688
    Chad Z. Hower aka Kudzu
    Feb 17, 2004
  2. Kal
    Replies:
    1
    Views:
    9,845
    Kevin Spencer
    Jun 21, 2004
  3. Jane Davis

    Network Service account over network

    Jane Davis, Jun 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    627
    Kevin Spencer
    Jun 22, 2005
  4. Bill Volk
    Replies:
    1
    Views:
    3,317
    Bill Volk
    Jul 2, 2003
  5. Kim Hamilton
    Replies:
    1
    Views:
    402
    Thomas Matthews
    Oct 14, 2003
  6. =?Utf-8?B?ZGlub28=?=

    Urgent - Windows Service Network Resource Access Issue

    =?Utf-8?B?ZGlub28=?=, Aug 10, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    610
    =?Utf-8?B?ZGlub28=?=
    Aug 10, 2006
  7. kin
    Replies:
    0
    Views:
    1,026
  8. king
    Replies:
    1
    Views:
    458
Loading...