On Saturday, August 3, 2002, at 10:56 , Karsten Borgwaldt wrote:
> Hi all, > > I tried to make two programms communicate with each other. I have tried > with IO::Socket, the most used Module I think, and with Net::TCP. > There are two possibilities, the first is that my brain is too small to > get the way these modules run, the second is that I forget a few things [..] I think you may want to go back and review the documents http://search.cpan.org/doc/SPIDB/Net-ext-1.011/lib/Net/TCP.pm http://search.cpan.org/doc/SPIDB/Net-ext-1.011/lib/Net/Gen.pm http://search.cpan.org/doc/SPIDB/Net-ext-1.011/lib/Net/TCP/Server.pm since it is not clear to me that > use Net::TCP; > > my $socket = Net::TCP->new(1234); > > $socket->send("127.0.0.1", "foobar"); does what you think it should.... I think you will need a bit more than the simple new() - and will actually want to a) open the connection b) check that the connect worked c) send something on it.... you will probably also need a similar re-work on the server side that will do the listen for connections - that I have traditionally seen done in a while( my $in = $socket->accept ) { ..... } ciao drieux --- one of my earliest in the group was: sub dtk_openSocket_to_webPage { my ( $dtk_host, $dtk_port, $dtk_sock ) = @_; my ( $iadder , $server ) ; my $proto = getprotobyname('tcp'); unless ( socket($dtk_sock, AF_INET, SOCK_STREAM, $proto) ) { die "Unable to create socket\n"; } unless ( setsockopt($dtk_sock, SOL_SOCKET, SO_REUSEADDR,1) ) { die "Unable to set socket\n"; } autoflush $dtk_sock; unless ( $iaddr = inet_aton($dtk_host)) { die "Unable to translate $dtk_host to an address\n"; } unless ( $server = sockaddr_in($dtk_port, $iaddr) ) { die "Unable to translate to server.\n"; } unless (connect($dtk_sock, $server)) { die "Connect Failed to server at $dtk_host:$dtk_port :$! \n"; } } # end of openSocket_to_webPage -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
