diff --git a/ixwebsocket/IXSocketSChannel.cpp b/ixwebsocket/IXSocketSChannel.cpp new file mode 100644 index 00000000..c5ecfae7 --- /dev/null +++ b/ixwebsocket/IXSocketSChannel.cpp @@ -0,0 +1,55 @@ +/* + * IXSocketSChannel.cpp + * Author: Benjamin Sergeant + * Copyright (c) 2018 Machine Zone, Inc. All rights reserved. + */ +#include "IXSocketSChannel.h" + +#ifdef _WIN32 +# include +# include +# include +# include +# include +#else + +namespace ix +{ + SocketSChannel::SocketSChannel() + { + ; + } + + SocketSChanne::~SocketSChannel() + { + + } + + bool SocketSChannel::connect(const std::string& host, + int port, + std::string& errMsg) + { + return Socket::connect(host, port, errMsg); + } + + void SocketSChannel::close() + { + Socket::close(); + } + + int SocketSChannel::send(char* buf, size_t nbyte) + { + return Socket::send(buf, nbyte); + } + + int SocketSChannel::send(const std::string& buffer) + { + return Socket::send(buffer); + } + + int SocketSChannel::recv(void* buf, size_t nbyte) + { + return Socket::recv(buf, nbyte); + } + +} diff --git a/ixwebsocket/IXSocketSChannel.h b/ixwebsocket/IXSocketSChannel.h new file mode 100644 index 00000000..f7698ddb --- /dev/null +++ b/ixwebsocket/IXSocketSChannel.h @@ -0,0 +1,31 @@ +/* + * IXSocketSChannel.h + * Author: Benjamin Sergeant + * Copyright (c) 2017-2018 Machine Zone, Inc. All rights reserved. + */ + +#pragma once + +#include "IXSocket.h" + +namespace ix +{ + class SocketSChannel : public Socket + { + public: + SocketAppleSSL(); + ~SocketAppleSSL(); + + virtual bool connect(const std::string& host, + int port, + std::string& errMsg) final; + virtual void close() final; + + virtual int send(char* buffer, size_t length) final; + virtual int send(const std::string& buffer) final; + virtual int recv(void* buffer, size_t length) final; + + private: + }; + +} diff --git a/ixwebsocket/IXWebSocketTransport.cpp b/ixwebsocket/IXWebSocketTransport.cpp index df8373ac..f553363f 100644 --- a/ixwebsocket/IXWebSocketTransport.cpp +++ b/ixwebsocket/IXWebSocketTransport.cpp @@ -16,6 +16,8 @@ # include "IXSocketAppleSSL.h" # elif defined(__linux__) # include "IXSocketOpenSSL.h" +# elif defined(_WIN32) +# include "IXSocketSChannel.h" # endif #endif @@ -146,6 +148,8 @@ namespace ix { _socket = std::make_shared(); # elif defined(__linux__) _socket = std::make_shared(); +# elif defined(_WIN32) + _socket = std::make_shared(); # endif #else return WebSocketInitResult(false, 0, "TLS is not supported.");