It sounds like you are reconnecting your socket without recreating your input and output streams.
Try running recreating your input and output streams after you run connect() like so:
output = new DataOutputStream(socket.getOutputStream());
stream = socket.getInputStream();