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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



gdan2000
Novice

Dec 24, 2011, 8:50 AM

Post #1 of 1 (1156 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:

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


(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