wood burning stoves 2.0
The moose likes Sockets and Internet Protocols and the fly likes connection problem... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "connection problem..." Watch "connection problem..." New topic

connection problem...

mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 251

i have problem to connect to server
i run the code and i get:

->connection ok
and after
->not able to connect to server

if i use telnet to connect server, i don't have any problem..

this is the code

any idea?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I'm not sure how you'd get from the first line that prints to the catch clause without going through the line that prints the server address.

Try writing out the stack trace of any exception you catch. That will point you to the line that failed.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 251
ya i forget to put code...

i will try to add more information i do:

i'm connect to a gateway to get some information to connect to a server...

in my main i do:


and now the code to connect to the server

the connection seem to stop correctely between client and Passerelle (gateway)
now i connect to the server i get:

serveur> succes:Connection au serveur reussi
connection reussi
client:~>java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)
at java.io.BufferedInputStream.read(BufferedInputStream.java:304)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at Client.ConnexionServeur(Client.java:105)
at Client.main(Client.java:189)
Imposible d'etablir une connexion avec le serveur

but in my main if i do only


don't call ConnectionServeur.....

and uncomment code /**********here*******/

i'm able to connect to the serveur....

any idea?
mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 251

in the connectionPasserelle, i removed stdIn... i can call connectionServeur in the main...
I agree. Here's the link: http://aspose.com/file-tools
subject: connection problem...
It's not a secret anymore!