0

Im trying a programming to build an app to send and receive messages it also uses everything is set and working except that the Connect Exception: it is constantly saying connection timed out... i have this code on working

socket s = new socket(destination,8888);

then furthur using the outputstream at firstly initiating end and then

socket d= new socket (sender,8888);

and then input stream at the receiving end and both system are well connect with the code

ServerSocket ss = new ServerSocket(8888);
Socket b= new Socket();
b=ss.accept();

what could possibly be wrong??

1 Answer 1

1

Alot of chat programs spawn a new Thread, when the connection has been made, have you considered that? if you just do

   ServerSocket ss = new ServerSocket(8888);
   Socket b= new Socket();
   b=ss.accept();

And you program ends after this line, it could cause a timeout exception because the client instantly lost the connection, when the server closed down.

if this is completely retarded, please provide more code, its hard to make assumptions about your implementation.

Sign up to request clarification or add additional context in comments.

1 Comment

its a very big code ... @DenLilleMand i can only say that the code about serversocket is just starting of the program..we are using the pipeline serversocket successfully

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.