|
RavEngine
|
#include <PxSocket.h>
Public Member Functions | |
| PxSocket (bool inEnableBuffering=true, bool blocking=true) | |
| bool | connect (const char *host, uint16_t port, uint32_t timeout=1000) |
| bool | listen (uint16_t port) |
| bool | accept (bool block) |
| void | disconnect () |
| bool | isConnected () const |
| const char * | getHost () const |
| uint16_t | getPort () const |
| bool | flush () |
| uint32_t | write (const uint8_t *data, uint32_t length) |
| uint32_t | read (uint8_t *data, uint32_t length) |
| void | setBlocking (bool blocking) |
| bool | isBlocking () const |
Public Member Functions inherited from physx::PxUserAllocated | |
| PX_INLINE void * | operator new (size_t, void *address) |
| PX_INLINE void | operator delete (void *, void *) |
| template<typename Alloc > | |
| PX_INLINE void * | operator new (size_t size, Alloc alloc, const char *fileName, int line) |
| template<typename Alloc > | |
| PX_INLINE void * | operator new (size_t size, size_t, Alloc alloc, const char *fileName, int line) |
| template<typename Alloc > | |
| PX_INLINE void * | operator new[] (size_t size, Alloc alloc, const char *fileName, int line) |
| template<typename Alloc > | |
| PX_INLINE void * | operator new[] (size_t size, size_t, Alloc alloc, const char *fileName, int line) |
| template<typename Alloc > | |
| PX_INLINE void | operator delete (void *ptr, Alloc alloc, const char *fileName, int line) |
| template<typename Alloc > | |
| PX_INLINE void | operator delete[] (void *ptr, Alloc alloc, const char *fileName, int line) |
| PX_INLINE void | operator delete (void *ptr) |
| PX_INLINE void | operator delete[] (void *ptr) |
Static Public Attributes | |
| static const uint32_t | DEFAULT_BUFFER_SIZE = 32768 |
Socket abstraction API
| bool physx::PxSocket::accept | ( | bool | block | ) |
Accept a connection on a socket that is in listening mode
| block | whether or not the call should block |
| bool physx::PxSocket::connect | ( | const char * | host, |
| uint16_t | port, | ||
| uint32_t | timeout = 1000 |
||
| ) |
Opens a network socket for input and/or output
| host | Name of the host to connect to. This can be an IP, URL, etc |
| port | The port to connect to on the remote host |
| timeout | Timeout in ms until the connection must be established. |
| void physx::PxSocket::disconnect | ( | ) |
Disconnects an open socket
| bool physx::PxSocket::flush | ( | ) |
Flushes the output stream. Until the stream is flushed, there is no guarantee that the written data has actually reached the destination storage. Flush forces all buffered data to be sent to the output.
| const char * physx::PxSocket::getHost | ( | ) | const |
Returns the name of the connected host. This is the same as the string that was supplied to the connect call.
| uint16_t physx::PxSocket::getPort | ( | ) | const |
Returns the port of the connected host. This is the same as the port that was supplied to the connect call.
| bool physx::PxSocket::isBlocking | ( | ) | const |
Returns whether read/write/flush calls to the socket are blocking.
| bool physx::PxSocket::isConnected | ( | ) | const |
Returns whether the socket is currently open (connected) or not.
| bool physx::PxSocket::listen | ( | uint16_t | port | ) |
Opens a network socket for input and/or output as a server. Put the connection in listening mode
| port | The port on which the socket listens |
| uint32_t physx::PxSocket::read | ( | uint8_t * | data, |
| uint32_t | length | ||
| ) |
Reads data from the output stream.
| data | Pointer to a buffer where the read data will be stored. |
| length | Amount of data to read, in bytes. |
| void physx::PxSocket::setBlocking | ( | bool | blocking | ) |
Sets blocking mode of the socket. Socket must be connected, otherwise calling this method won't take any effect.
| uint32_t physx::PxSocket::write | ( | const uint8_t * | data, |
| uint32_t | length | ||
| ) |
Writes data to the output stream.
| data | Pointer to a block of data to write to the stream |
| length | Amount of data to write, in bytes |