added timeout for connection

added timeout for connection