I have the following code:
private Socket mSenderSocket = null;
private DataInputStream in = null;
private DataOutputStream out = null;
...
try
{
mSenderSocket = new Socket(java.net.InetAddress.getByName(TCP_SERVER_IP), 12345);
out = new DataOutputStream(mSenderSocket.getOutputStream());
in = new DataInputStream(mSenderSocket.getInputStream());
}
catch (UnknownHostException ex)
{
System.err.println("Don't know about host.");
}
catch(IOException ex)
{
System.err.println("Couldn't get I/O");
}
I am interested in the following scenario:
During the chat session if an I/O exception occurs then I have to do the following:
mSenderSocket = new Socket(java.net.InetAddress.getByName(TCP_SERVER_IP);
Now what happens with the DataInputStream and the DataOutputStream?
Should I initialize theese objects again or not?