Added timeout code to NetworkListener.