0

I have created a ServerSocket binded with a port in my application. I distribute this application to the connected PCs on the same network. I can post a request to any of the PC where the application is installed, using this port. Now the recepients can receive the messages, but when they send the response back to the requesting PC, the Input stream never receives the message. Is there a way to do it. I do not know any thing about URGENT TCP messages. I enabled it but I do not know how to send them. Is my message being discarded by default? I do not get the answer in other threads.

1
  • Post some of your code to see what you are doing Commented Nov 26, 2011 at 14:07

2 Answers 2

1

Do you flush the outputstream on the PCs sending data?

// Send data here  
yourOutputStreamReference.flush();
Sign up to request clarification or add additional context in comments.

3 Comments

Hello, I am doing it, apart from that, I have tried shutdowninputstream, and shutdownoutputstream. I can send my requests to other application, but when the server there, sends back the response, I can not get it.
The same code: when I send the request to myself.. response comes back to me.. on the client side from the server side. Same is not happening between devices...
As I found out, all the responses must be done in a new request redirected to the server at that side..
1

There should be a loop in both ClientSocket and ServerSocket that keeps communication in the active state.

Otherwise: There should be implementation of both client socket and a server socket on all the sides (all the sender and receiver devices). When a server socket A receives a message, in order to reply back, there should be a client socket that replies back to server socket B which resides in the sender's application in his device.

In this way, all the devices with a server socket with the same port can detect and send messages to each other.

Of course the IP address of the sender should be kept in order to reply back.

Comments

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.