This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Please UseCodeTags next time. It adds syntax highlighting, and preserves indentation. I've added them for you this time.
sneha ponnusamy wrote:when i submit the values.i am getting this error.
You try to connect to port 80 on your local machine. That mean there must be a service running on port 80. Your program is definitely not running one; I don't see any ServerSocket anywhere.
To create a client-server pair the usual setup is common:
- The server has a ServerSocket. It listens in a loop for new Socket connections (calling accept()). For each new Socket connection it either handles it immediately (for fast request handling) or starts a new thread to handle it (if request handling takes longer).
- The client connects to this ServerSocket using the Socket constructor you're already using.