make connect accept a timeout parameter