Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 23037 invoked from network); 4 Jan 2005 14:39:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 4 Jan 2005 14:39:28 -0000 Received: (qmail 60593 invoked by uid 500); 4 Jan 2005 14:38:39 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 60581 invoked by uid 500); 4 Jan 2005 14:38:38 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 60550 invoked by uid 99); 4 Jan 2005 14:38:38 -0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=FORGED_RCVD_HELO,URIBL_SBL X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from h-64-105-195-133.atlngahp.covad.net (HELO redesetgrow.com) (64.105.195.133) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 04 Jan 2005 06:38:35 -0800 Received: from (10.17.18.70 [10.17.18.70]) by MailEnable Inbound Mail Agent with ESMTP; Tue, 04 Jan 2005 09:46:08 -0500 Message-ID: <41DAAA5B.9020701@redesetgrow.com> Date: Tue, 04 Jan 2005 09:38:19 -0500 From: Wade Chandler Organization: Red-e Set Grow User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: daemon issue References: <1104782101.41d9a315a0b3c@webmail.toadmail.com> <41DA326B.6070400@redesetgrow.com> <1104848495.41daa66f0896b@webmail.toadmail.com> In-Reply-To: <1104848495.41daa66f0896b@webmail.toadmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Eric Renouf wrote: > Hi Wade, > > Yes it is able to create the ServerSocket in a Thread spawned from the start() > method. That socket is able to listen to incoming connections and spawn a new > thread to handle each incoming connection. I added a test inside that thread > that handles the connections to create a socket to a remote host on port 80 and > that succeeds. The handler thread then processes the input and one possible > action for it is to start a new thread that will use HttpClient to "surf" the > web. The surfing thread seems unable to create sockets though. The HttpClient > raises a java.net.ConnectException, as does just trying to create a new socket > on port 80 similar to the one that succeeded previously in the handler thread. > > Oh yeah, in case it makes a difference to anyone here's some of the stuff I'm > using to run it: > > JDK 1.5.0 > RedHat 7.3 with kernel 2.4.20 > commons-daemon-1.0 > > Thanks, > Eric > > Quoting Wade Chandler : > > >>Eric Renouf wrote: >> >>>Hi all, >>> >>>I'm trying to write a Java Daemon which will listen for incoming >> >>connections and >> >>>when it gets certain commands start up various threads or processes. The >>>problem that I'm having right now involves the spawned threads creating >> >>sockets. >> >>>When running via jsvc as a daemon the main listening thread spawns a thread >> >>to >> >>>handle each connection. That thread is able to create a new Socket(host, >> >>port) >> >>>with no problem (just added for testing purposes). That thread the >> >>processes >> >>>the command and, in some cases, spawns a new thread that uses the >> >>HttpClient >> >>>package to retrieve a web page, but that failes with a >> >>java.net.ConnectException >> >>>connection failed. If I just try to do the same Socket(host, port) as the >>>listening thread does that also fails. >>> >>>Also if I run the whole thing by hand, not as a Daemon everything seems to >> >>work >> >>>just fine. >>> >>>Can anyone help point out something that I could be overlooking, because >> >>I'm not >> >>>sure what else to try as far as tracking this down goes. >>> >>>Thanks, >>>Eric >>>___________________________________________________________ >>>This mail sent using ToadMail -- Web based e-mail @ ToadNet >>> >>>--------------------------------------------------------------------- >>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >>>For additional commands, e-mail: commons-user-help@jakarta.apache.org >>> >>> >>> >> >>Do you have any logging to see if your process is actually binding to >>the server port fine? Maybe log that, and in the main setup code try to >>make a socket connection to test your server before you continue on and >>debug that section of code. >> >>Wade >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >>For additional commands, e-mail: commons-user-help@jakarta.apache.org >> > > > > > ___________________________________________________________ > This mail sent using ToadMail -- Web based e-mail @ ToadNet > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > Just for checkking.....you aren't trying to use some type of a global object for the HttpClient are you? Figure you'd at least get a different error though. hmm. seems strange. The server on port 80...is it a well known server like Apache or something, or is it another program you have written. If so are you sure it is able to handle multiple connections correctly? I would say that maybe there is a bug in the 1.5 jdk, but I have used it to make connections...not using HttpClient, but the standard URLConnection classes. Did you get a stack trace? While the other application isn't able to make connections to the remote servers port 80 are other applications from the same computer able to connect to that servers port 80? Wade --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org