CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
strange problem with opening tcp socket



Dec 24, 2011, 8:50 AM

Post #1 of 1 (1731 views)
strange problem with opening tcp socket Can't Post

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; 
$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 ?

(This post was edited by gdan2000 on Dec 24, 2011, 9:40 AM)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives