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. Advertising

  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. Advertising

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. Kal
    Replies:
    1
    Views:
    9,502
    Kevin Spencer
    Jun 21, 2004
  2. Jane Davis

    Network Service account over network

    Jane Davis, Jun 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    425
    Kevin Spencer
    Jun 22, 2005
  3. Bill Volk
    Replies:
    1
    Views:
    3,129
    Bill Volk
    Jul 2, 2003
  4. kin
    Replies:
    0
    Views:
    908
  5. king
    Replies:
    1
    Views:
    265
Loading...

Share This Page