Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

strange problem with opening tcp socket

by gdanenb (Acolyte)
on Dec 24, 2011 at 16:47 UTC ( #945031=perlquestion: print w/ replies, xml ) Need Help??
gdanenb has asked for the wisdom of the Perl Monks concerning the following question:

I have very strange problem...
I've written a script that uses REST::Client module to run tests over HTTP.
Its working fine besides against one particular java application with embedded tomcat(on Linux)
When REST Client opens tcp socket, the server immediately aborts it (SYN->SYN,ACK->ACK and then FYN,ACK from server),
As a result of closing connection by server, LWP module prints "500 Server closed connection without sending any data back".
The java application is a production one and dont make any problem when accessed from another applications or web ui.

I found some old script on the system that opens socket successfully, the script implements socket directly:

$AF_INET = 2; $SOCK_STREAM = 1; $sockaddr = 'S n a4 x8'; $this = pack($sockaddr, $AF_INET, 0, $thisaddr); $that = pack($sockaddr, $AF_INET, $port, $thataddr); ($name,$aliases,$proto) = getprotobyname('tcp'); socket(S, $AF_INET, $SOCK_STREAM, $proto) || die "socket: $!"; bind(S, $this) || die "bind: $!"; if (connect(S, $that)) { print connetced } select(S); $| = 1; select(STDOUT); print S "$USER_VALUE CHECK $host\n";

I debugged REST and underlying modules and saw that parameter passed to socket are similar (besides $sockaddr = 'S n a4 x8' which I didnt understand..)
What is the problem here ?

Comment on strange problem with opening tcp socket
Download Code
Re: strange problem with opening tcp socket
by Anonymous Monk on Dec 24, 2011 at 17:32 UTC

    What is the problem here ?

    Not enough of the right kind of information , like LWP::Debug output from successful and failing request, or WireShark output of same, or actual REST::Client code that demonstrates the problem (I this might not be possible)

    The $sockaddr is just a pack template, a DIY way to prepare an adress for socket, use IO::Socket instead

      Please ignore this post, the problem was in tomcat implementation of java program.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://945031]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2014-09-01 13:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (11 votes), past polls