anchor.diff:  
   start_daemon(Socket, Options) ->
       case handle_options(Options) of
  -	{error, _Reason} = Error ->
  -	    Error;
  -	{SocketOptions, SshOptions}->
  -	    try 
  -		do_start_daemon(Socket, [{role,server}|SshOptions], SocketOptions)
  -	    catch
  -		throw:bad_fd -> {error,bad_fd};
  -		_C:_E -> {error,{cannot_start_daemon,_C,_E}}
  +	{error, Error} ->
  +	    {error, Error};
  +	{SocketOptions, SshOptions} ->
  +	    case valid_socket_to_use(Socket, Options) of
  +		ok -> 
  +		    try 
  +			do_start_daemon(Socket, [{role,server}|SshOptions], SocketOptions)
  +		    catch
  +			throw:bad_fd -> {error,bad_fd};
  +			_C:_E -> {error,{cannot_start_daemon,_C,_E}}
  +		    end;
  +		{error,SockError} ->
  +		    {error,SockError}
   	    end
       end.
   
  
positive.code: %%--------------------------------------------------------------------
  %%% Internal functions
  %%--------------------------------------------------------------------
  daemon_shell_opt(Options) ->
       case proplists:get_value(shell, Options) of
  	 undefined ->
  
negative.code: 
  connect(Socket, Options, Timeout) when is_port(Socket) ->
      case handle_options(Options) of
  	{error, Error} ->
  	    {error, Error};
  	{_SocketOptions, SshOptions} ->
  	    case valid_socket_to_use(Socket, Options) of
  		ok -> 
  		    {ok, {Host,_Port}} = inet:sockname(Socket),
  		    Opts =  [{user_pid,self()}, {host,fmt_host(Host)} | SshOptions],
  		    ssh_connection_handler:start_connection(client, Socket, Opts, Timeout);
  		{error,SockError} ->
  		    {error,SockError}
  	    end
      end;
  
  connect(Host, Port, Options) when is_integer(Port), Port>0 ->
      connect(Host, Port, Options, infinity).
  
  