Sha256: 2de38186a6fa01297ad9b75e1b27e1ee5828f61e335af710eb0881e126e6f56e

Contents?: true

Size: 1.31 KB

Versions: 18

Compression:

Stored size: 1.31 KB

Contents

#ifndef RHO_RAW_SOCKET_F5FFD21AD3EE463E850C5E2C789397BD
#define RHO_RAW_SOCKET_F5FFD21AD3EE463E850C5E2C789397BD

#include "common/RhoStd.h"
#include "logging/RhoLog.h"

#if !defined(OS_WINDOWS) && !defined(OS_WINCE)
typedef int SOCKET;
#  define INVALID_SOCKET -1
#  define SOCKET_ERROR -1
#  define RHO_NET_ERROR_CODE errno
#  define closesocket close
#else
#  if defined(OS_WINCE)
#    include <winsock2.h>
#    include <ws2tcpip.h>
#  endif
#  define RHO_NET_ERROR_CODE ::WSAGetLastError()
#endif

namespace rho
{
namespace net
{

#if !defined(OS_WINCE)

class RawSocket
{
public:
    RawSocket(const String& host, const String& port)  {}
    virtual ~RawSocket() {}

    bool init() { return false; }

    bool send(const String& sendData) { return false; }

    bool isInit() const { return false; }
};

#else                 

class RawSocket
{
private:
    SOCKET m_clientSocket;

    std::string m_hostName;
    std::string m_hostPort;

    bool m_isInit;
public:
    RawSocket(const String& host, const String& port) 
         : m_hostName(host) , m_hostPort(port), m_isInit(false) {}
    virtual ~RawSocket() { cleanup(); }

    bool init();

    bool send(const String& sendData);

    bool isInit() const { return m_isInit; }

private:
    bool create();

    void cleanup();
};

#endif

} // end of net
} // end if rho

#endif

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rhodes-3.0.2 platform/shared/net/RawSocket.h
rhodes-3.0.2.beta.1 platform/shared/net/RawSocket.h
rhodes-3.0.1 platform/shared/net/RawSocket.h
rhodes-3.0.1.beta.8 platform/shared/net/RawSocket.h
rhodes-3.0.1.beta.7 platform/shared/net/RawSocket.h
rhodes-3.0.1.beta.6 platform/shared/net/RawSocket.h
rhodes-3.0.1.beta.5 platform/shared/net/RawSocket.h
rhodes-3.0.1.beta.4 platform/shared/net/RawSocket.h
rhodes-3.0.1.beta.3 platform/shared/net/RawSocket.h
rhodes-3.0.1.beta.2 platform/shared/net/RawSocket.h
rhodes-3.0.0 platform/shared/net/RawSocket.h
rhodes-3.0.0.beta.7 platform/shared/net/RawSocket.h
rhodes-3.0.0.beta.6 platform/shared/net/RawSocket.h
rhodes-3.0.0.beta.5 platform/shared/net/RawSocket.h
rhodes-3.0.0.beta.4 platform/shared/net/RawSocket.h
rhodes-3.0.0.beta.3 platform/shared/net/RawSocket.h
rhodes-3.0.0.beta.2 platform/shared/net/RawSocket.h
rhodes-3.0.0.beta.1 platform/shared/net/RawSocket.h