isapego commented on code in PR #2149:
URL: https://github.com/apache/ignite-3/pull/2149#discussion_r1219750234


##########
modules/platforms/cpp/ignite/network/detail/win/tcp_socket_client.h:
##########
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "ignite/network/detail/win/sockets.h"
+
+#include <cstdint>
+#include <sstream>
+
+#include "ignite/network/detail/utils.h"
+#include "ignite/network/socket_client.h"
+
+namespace ignite::network
+{
+
+/**
+ * Socket client implementation.
+ */
+class tcp_socket_client : public socket_client
+{
+public:
+    // Delete
+    tcp_socket_client(tcp_socket_client &&) = delete;
+    tcp_socket_client(const tcp_socket_client &) = delete;
+    tcp_socket_client &operator=(tcp_socket_client &&) = delete;
+    tcp_socket_client &operator=(const tcp_socket_client &) = delete;
+
+    /** Buffers size */
+    enum { BUFFER_SIZE = 0x10000 };
+
+    // Default
+    tcp_socket_client() = default;
+
+    /**
+     * Destructor.
+     */
+    ~tcp_socket_client() override {
+        internal_close();
+    }
+
+    /**
+     * Establish connection with remote TCP service.
+     *
+     * @param hostname Remote host name.
+     * @param port TCP service port.
+     * @param timeout Timeout.
+     * @return True on success.
+     */
+    bool connect(const char* hostname, std::uint16_t port, std::int32_t 
timeout) override
+    {
+        detail::init_wsa();
+
+        internal_close();
+
+        addrinfo hints = { 0 };
+
+        hints.ai_family = AF_UNSPEC;
+        hints.ai_socktype = SOCK_STREAM;
+        hints.ai_protocol = IPPROTO_TCP;
+
+        std::stringstream converter;
+        converter << port;
+        std::string strPort = converter.str();
+
+        // Resolve the server address and port
+        addrinfo *result{NULL}; // NOLINT(modernize-use-nullptr)
+        int res = getaddrinfo(hostname, strPort.c_str(), &hints, &result);
+
+        if (res != 0)

Review Comment:
   Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to