On Wed, 2004-02-11 at 10:53 -0800, Stas Bekman wrote: > Michael Maciag wrote: > >>Which Unix? I've heard about the troubles with sockets on AIX (w/ mod_perl > > > > 1) > > > > Solaris 8. > > > > > >>Have you read: > > > > Yes. However, unless I'm confused, that is a bit different in that it is an > > example of using APR to work with the socket established by Apache to > > communicate with the client. I need to establish my own UDP conversation > > with a "third-party" service from where I'll retrieve data which I'll use to > > compose my response to the client. If I can use APR to do that, great, but I > > couldn't find docs/samples/tests that create/open/close APR sockets. > > Ah, then yes, you should be able to use Perl sockets. I doubt that the problem > has to do anything with mod_perl, though. YOu said that recv fails, but you > dind't specify what was the error message. > > Also I remember Philippe was working on mod_udp or something like that, so he > certainly will know if there are any special Apache issues to deal with. Philippe?
If you are trying to send an UDP query over to a server and read a response from it in Perl, there is no problem, really, i.e.: use strict; use IO::Socket::INET; sub handler { my $r = shift; my $socket = new IO::Socket::INET ( PeerAddr => 'localhost:echo', Proto => 'udp', Type => SOCK_DGRAM, ) || die $!; $socket->send($r->path_info) || die $!; my $response; $socket->recv($response, length($r->path_info)) || die $!; print ($r->path_info eq $response) ? "OK" : "NOK"; } Just works fine! In a case like this one, trying to use APR for UDP is overkill. Use Perl. Gozer out. > __________________________________________________________________ > Stas Bekman JAm_pH ------> Just Another mod_perl Hacker > http://stason.org/ mod_perl Guide ---> http://perl.apache.org > mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com > http://modperlbook.org http://apache.org http://ticketmaster.com -- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
signature.asc
Description: This is a digitally signed message part