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);
static unsigned int DNS_LOOKUP_TIMEOUT_MS
See description of CClientTCPSocket.
~CClientTCPSocket()
Destructor.
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.
bool sendMessage(const mrpt::utils::CMessage &outMsg, const int timeout_ms=-1)
Send a message through the TCP stream.
bool isConnected()
Returns true if this objects represents a successfully connected socket.
#define THROW_EXCEPTION(msg)
int setSOSendBufffer(const int &newValue)
Set the size of the SO send buffer.
int getSOSendBufffer()
Return the current 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 ...
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.
std::string m_remotePartIP
The IP address of the remote part of the connection.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
A TCP socket that can be wait for client connections to enter.
CClientTCPSocket()
Default constructor.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
int getTCPNoDelay()
Return the value of the TCPNoDelay option.
int m_hSock
The handle for the connected TCP socket, or -1.
GLsizei const GLchar ** string
std::string getLastErrorStr()
Returns a description of the last Sockets error.
unsigned __int64 uint64_t
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.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
int setTCPNoDelay(const int &newValue)
Set the TCP no delay option of the protocol (Nagle algorithm).
A TCP socket that can be connected to a TCP server, implementing MRPT's CStream interface for passing...
void close()
Closes 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...
unsigned short m_remotePartPort
The TCP port of the remote part of the connection.
size_t getReadPendingBytes()
Return the number of bytes already in the receive queue (they can be read without waiting) ...
uint64_t getTotalBytesCount() 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.
unsigned __int32 uint32_t
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...
A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object...
void sendString(const std::string &str)
Writes a string to the socket.