Implementing TCP request and answer [closed]

1. I'm creating an application where client connects to server, retrieves some data and after that connection is closed.

2. He spends some time changing that data and then connects again to the server sends it back and connection is closed.

3. At server data is compared with original and saved to database if it validates.

I see only one solution to this - creating two ServerSocket one for input and one for output. But it does not seem good solution. Is this the way to do it or is there something else? How can I determine purpose of connection?

PS I'm using JAVA 8.

closed as off-topic by Yuval Filmus, Kyle Jones, Juho, Tom van der Zanden, David RicherbyMay 31 '15 at 9:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Questions about software development or programming tools are off-topic here, but can be asked on Stack Overflow." – Yuval Filmus, Kyle Jones, Juho, Tom van der Zanden, David Richerby
If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to Computer Science! Your question is off-topic here: we deal with computer science questions, not programming questions (see our FAQ). Your question might be on-topic on Stack Overflow. – André Souza Lemos May 31 '15 at 1:49