a socket programming calculating the transmission time