Commits

spencercw committed 60a8d84

#33 Add missing file from previous commit.

  • Participants
  • Parent commits 7936985
  • Branches serial

Comments (0)

Files changed (1)

File gb_net/include/gb_net/tcp_client.h

+/*  Copyright Š 2011 Chris Spencer <spencercw@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef GBNET_TCP_CLIENT_H
+#define GBNET_TCP_CLIENT_H
+
+#include <stdint.h>
+
+#include <string>
+
+#include <gb_net/networking.h>
+
+namespace gbnet {
+
+namespace internal {
+	class TcpClientImpl;
+}
+
+//! TCP client.
+class GBNET_API TcpClient: public Networking
+{
+public:
+	//! Constructor; connects to the given remote server.
+	/**
+	 * To be notified of any errors in connecting to the server register with the
+	 * Networking::onNetworkError() signal before calling \c run() or \c poll() on the I/O service.
+	 * \param ioService The I/O service to use for networking communications.
+	 * \param host The hostname or IP address (may be IPv4 or IPv6 where the operating system
+	 * supports it) of the server to connect to.
+	 * \param port The TCP port the server is listening on.
+	 */
+	TcpClient(boost::asio::io_service &ioService, const std::string &host, uint16_t port);
+
+	//! Destructor.
+	~TcpClient();
+
+private:
+	// Implementation
+	internal::TcpClientImpl *impl_;
+
+	// Disabled operations
+	TcpClient(const TcpClient &);
+	TcpClient & operator=(const TcpClient &);
+};
+
+}
+
+#endif