Interviewer And Interviewee Guide

Socket Programming Interview Question:

How do I close sockets?

Submitted by: Administrator
You should always close the output and input stream before you close the socket.

On the client side:

try {
output.close();
input.close();
MyClient.close();
}
catch (IOException e) {
System.out.println(e);
}

On the server side:

try {
output.close();
input.close();
serviceSocket.close();
MyService.close();
}
catch (IOException e) {
System.out.println(e);
}
Submitted by: Administrator

Read Online Socket Programming Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.