I\'m programming a class to communicate to a server but when it tries to construct the ObjectInputStream with the help of the inputstream the program is freezing. There
The ObjectInputStream constructor reads data from the given InputStream. In order for this to work, you must flush the ObjectOutputStream immediately after construction (to write the initial header) before you attempt to open the ObjectInputStream. Also, if you want to send more than one object per connection, you must open the ObjectOutputStream once and use it for the lifetime of the socket (e.g. your shareToAll
method).