Update network.cpp

Detection for disconnecting