Wouldn't it be easier to use the SOAP module?
 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jack Coates
Sent: Friday, April 21, 2006 1:30 PM
To: [email protected]
Subject: XML transfer, IO::Socket, IO::Select questions

Hi all,

I might be barking up the wrong tree here, so please feel free to tell me there's a better way...

I want to transfer some XML files from assorted clients to a server -- this is all running in a Windows environment, and the server has IIS on it. The server is going to parse the XML and insert it into a database.

I've been trying out IO::Socket and IO::Select, and things seem to work just fine as long as there's not much going on -- but if I load test it with a loop, "excess" submitters just get "Socket not created:  Unknown error". Is the right thing to evaluate and keep trying until I don't get an error?

Also, I'm not clear on the behaviors between IO::Socket's Listen parameter and IO::Select's can_read... IO::Select's manual suggests doing this:

my $Socket = IO::Socket::INET->new(LocalPort=>8000, Type=>SOCK_STREAM, Reuse=>1, Listen=>1);
if (not defined $Socket) { die "ERROR: cannot listen on port 8000: [$!]\n"; }
my $selector = new IO::Select ($Socket);
while (my @ready = $selector->can_read) {
    foreach my $handle (@ready) {
        if ($handle == $Socket) {
            # Create a new socket
            my $client = $Socket->accept;
            while (<$client>) {
                    print "$_\n";
           }
        } else {
            # clean up this socket
            $selector->remove($handle);
            $handle->close;
        }
    }
}

I'm guessing that Listen == number of sockets that we'll open in response to SYN packets, then $Socket->accept causes the TCP handshake to complete?

I'm also nervous about using IO::Socket directly, seems that I need to do a lot of filtering to make sure that I'm getting the expected content -- is there a simple framework to just transfer XML?

thanks,
--
"I spent all me tin with the ladies drinking gin,
So across the Western ocean I must wander" -- traditional
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to