2 * @brief TCP/IP socket based RemoteDatabase implementation
4 /* Copyright (C) 2008,2010 Olly Betts
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "remotetcpclient.h"
25 #include <xapian/error.h>
28 #include "tcpclient.h"
33 RemoteTcpClient::open_socket(const string
& hostname
, int port
,
34 double timeout_connect
)
36 // If TcpClient::open_socket() throws, fill in the context.
38 return TcpClient::open_socket(hostname
, port
, timeout_connect
, true);
39 } catch (const Xapian::NetworkTimeoutError
& e
) {
40 throw Xapian::NetworkTimeoutError(e
.get_msg(), get_tcpcontext(hostname
, port
),
41 e
.get_error_string());
42 } catch (const Xapian::NetworkError
& e
) {
43 throw Xapian::NetworkError(e
.get_msg(), get_tcpcontext(hostname
, port
),
44 e
.get_error_string());
49 RemoteTcpClient::get_tcpcontext(const string
& hostname
, int port
)
51 string
result("remote:tcp(");
59 RemoteTcpClient::~RemoteTcpClient()