45 #ifdef MRPT_OS_WINDOWS
48 #if MRPT_WORD_SIZE == 64
68 size_t Read(
void* Buffer,
size_t Count)
override;
76 size_t Write(
const void* Buffer,
size_t Count)
override;
98 const std::string& remotePartAddress,
unsigned short remotePartTCPPort,
99 unsigned int timeout_ms = 0);
155 void* Buffer,
const size_t Count,
const int timeoutStart_ms = -1,
156 const int timeoutBetween_ms = -1);
170 const void* Buffer,
const size_t Count,
const int timeout_ms = -1);
192 const unsigned int timeoutBetween_ms = 1000);
A TCP socket that can be connected to a TCP server, implementing MRPT's CStream interface for passing...
bool sendMessage(const mrpt::utils::CMessage &outMsg, const int timeout_ms=-1)
Send a message through the TCP stream.
size_t getReadPendingBytes()
Return the number of bytes already in the receive queue (they can be read without waiting)
uint64_t Seek(uint64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) override
This virtual method has no effect in this implementation over a TCP socket, and its use raises an exc...
int m_hSock
The handle for the connected TCP socket, or -1.
std::string getLastErrorStr()
Returns a description of the last Sockets error.
uint64_t getTotalBytesCount() override
This virtual method has no effect in this implementation over a TCP socket, and its use raises an exc...
static unsigned int DNS_LOOKUP_TIMEOUT_MS
See description of CClientTCPSocket.
void sendString(const std::string &str)
Writes a string to the socket.
bool isConnected()
Returns true if this objects represents a successfully connected socket.
int setSOSendBufffer(const int &newValue)
Set the size of the SO send buffer.
size_t Read(void *Buffer, size_t Count) override
Introduces a virtual method responsible for reading from the stream (This method BLOCKS) This method ...
void connect(const std::string &remotePartAddress, unsigned short remotePartTCPPort, unsigned int timeout_ms=0)
Establishes a connection with a remote part.
size_t Write(const void *Buffer, size_t Count) override
Introduces a virtual method responsible for writing to the stream.
int getSOSendBufffer()
Return the current size of the SO send buffer.
unsigned short m_remotePartPort
The TCP port of the remote part of the connection.
uint64_t getPosition() override
This virtual method has no effect in this implementation over a TCP socket, and its use raises an exc...
size_t readAsync(void *Buffer, const size_t Count, const int timeoutStart_ms=-1, const int timeoutBetween_ms=-1)
A method for reading from the socket with an optional timeout.
std::string m_remotePartIP
The IP address of the remote part of the connection.
int setTCPNoDelay(const int &newValue)
Set the TCP no delay option of the protocol (Nagle algorithm).
CClientTCPSocket()
Default constructor.
int getTCPNoDelay()
Return the value of the TCPNoDelay option.
bool receiveMessage(mrpt::utils::CMessage &inMsg, const unsigned int timeoutStart_ms=100, const unsigned int timeoutBetween_ms=1000)
Waits for an incoming message through the TCP stream.
void close()
Closes the connection.
~CClientTCPSocket()
Destructor.
size_t writeAsync(const void *Buffer, const size_t Count, const int timeout_ms=-1)
A method for writing to the socket with optional timeouts.
A TCP socket that can be wait for client connections to enter.
A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
GLsizei const GLchar ** string
#define THROW_EXCEPTION(msg)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int32 uint32_t
unsigned __int64 uint64_t