Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions dlib/sockets/sockets_extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,24 @@ namespace dlib
return data->con;
}

// ----------------------------------------------------------------------------------------

connection* connect (
const std::string& path
)
{
connection* con;

if(create_connection(con,path))
{
std::ostringstream sout;
sout << "unable to connect to '" << path << "'";
throw socket_error(sout.str());
}

return con;
}

// ----------------------------------------------------------------------------------------

bool is_ip_address (
Expand Down
6 changes: 6 additions & 0 deletions dlib/sockets/sockets_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ namespace dlib
unsigned long timeout
);

// ----------------------------------------------------------------------------------------

connection* connect (
const std::string& path
);

// ----------------------------------------------------------------------------------------

bool is_ip_address (
Expand Down
16 changes: 16 additions & 0 deletions dlib/sockets/sockets_extensions_abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,22 @@ namespace dlib
- std::bad_alloc
!*/

// ----------------------------------------------------------------------------------------

connection* connect (
const std::string& path
);
/*!
ensures
- returns a connection object that is connected to a unix socket created
at the given path
throws
- dlib::socket_error
This exception is thrown if there is some problem that prevents us from
creating the connection
- std::bad_alloc
!*/

// ----------------------------------------------------------------------------------------


Expand Down
Loading
Loading