commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Lawrence Murphy" <ga...@teledyn.com>
Subject Strange connection problem with commons-net 1.4.1
Date Thu, 15 Nov 2007 15:45:54 GMT
The problem also occurred with 1.4.0 and it may be due to upgrading
from Sun Java 1.4 to 1.5.0 -- I am still trying combinations of
options :]

I have a TelnetClient that is connecting to a newswire service; the
exact parameters of the remote service are unknown, but if I use Linux
comand "telnet $HOST $PORT" I get the login prompts and the data
starts flowing.  This was the case with the code compiled under Java
1.4.  In the Java 1.5 compiled code (using the commons-net-1.4.1.jar
from the website), I only sometimes get the login sequence, and then
it keeps receiving blank lines.  If I go back to the commandline
telnet utility, I get text data as expected.  What could be going
wrong with the TelnetClient settings?

My connection is mostly just using the defaults. I open this connection with

TelnetClient socket = new TelnetClient();
socket.setDefaultTimeout(3000);
socket.connect(host, port);
socklet.setSoTimeout(30000);

and it passes the sendAYT test, but /sometimes/ the
socket.getInputStream() returns null, other times it returns a stream,
but when I buffer it:

BufferedReader in = new BufferedReader( new InputStreamReader(
socket.getInputStream()));

in.readLine() only returns blank lines :(

the above code seems pretty foolproof, but it doesn't work -- and it
is most annoying that the command line telnet has no troubles at all
with the connection -- Is there a likely configuration setting that I
could be missing?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message