Public Member Functions | |
NTcpSocket (void) | |
Creates a NTcpSocket object. | |
NTcpSocket (NHostAddress &host) | |
Creates a NTcpSocket object. | |
NTcpSocket (const NString &host, nuint16 port) | |
Creates a NTcpSocket object. | |
~NTcpSocket (void) | |
Destroys a NTcpSocket object. | |
void | setPort (nint16 port) |
Sets the port associated with the socket. | |
void | setSocketOptions (nint32 opt) |
Sets socket options. | |
NHostAddress | peerAddress (void) const |
Gets the address of the remote host. | |
NString | peerName (void) const |
Gets the name of the remote host. | |
nuint16 | peerPort (void) const |
Gets the port of the remote host. | |
void | open (void) |
Open the socket. | |
void | closeDevice (void) |
Closes the socket. | |
void | disconnectFromHost (void) |
Disconnects from the remote host. | |
void | connectToHost () |
Connects to a host. | |
void | execListen (void) |
Starts listening. | |
NTcpSocket * | waitForConnected (void) |
Waits until a connection occurs. | |
nint32 | read (NDataStream *buffer) |
Reads data from the socket. | |
nint32 | read (NDataStream *buffer, nuint32 bytes=0) |
Reads data from the socket. | |
nint32 | readLine (NDataStream *buffer) |
Reads a line from the socket. | |
nint32 | write (const NDataStream &data, nuint32 bytes=0) |
Writes data to the socket. | |
nint32 | writeLine (const NDataStream &data, nuint32 bytes=0) |
Writes a line of data to the socket. | |
NTcpSocket (void) | |
Creates a NTcpSocket object. | |
NTcpSocket (NHostAddress &host) | |
Creates a NTcpSocket object. | |
NTcpSocket (const NString &host, nuint16 port) | |
Creates a NTcpSocket object. | |
~NTcpSocket (void) | |
Destroys a NTcpSocket object. | |
void | setPort (nint16 port) |
Sets the port associated with the socket. | |
void | setSocketOptions (nint32 opt) |
Sets socket options. | |
NHostAddress | peerAddress (void) const |
Gets the address of the remote host. | |
NString | peerName (void) const |
Gets the name of the remote host. | |
nuint16 | peerPort (void) const |
Gets the port of the remote host. | |
void | open (void) |
Open the socket. | |
void | closeDevice (void) |
Closes the socket. | |
void | disconnectFromHost (void) |
Disconnects from the remote host. | |
void | connectToHost () |
Connects to a host. | |
void | execListen (void) |
Starts listening. | |
NTcpSocket * | waitForConnected (void) |
Waits until a connection occurs. | |
nint32 | read (NDataStream *buffer) |
Reads data from the socket. | |
nint32 | read (NDataStream *buffer, nuint32 bytes) |
Reads data from the socket. | |
nint32 | readLine (NDataStream *buffer) |
Reads a line from the socket. | |
nint32 | write (const NDataStream &data, nuint32 bytes=0) |
Writes data to the socket. | |
nint32 | writeLine (const NDataStream &data, nuint32 bytes=0) |
Writes a line of data to the socket. |
Definition at line 50 of file linux/ntcpsocket.h.
NTcpSocket | ( | NHostAddress & | host | ) |
Creates a NTcpSocket object.
host | Hostname/ip associated with the socket |
Definition at line 32 of file linux/ntcpsocket.cpp.
NTcpSocket | ( | const NString & | host, | |
nuint16 | port | |||
) |
Creates a NTcpSocket object.
host | Hostname/ip associated with the socket | |
port | Port associated with the socket |
Definition at line 41 of file linux/ntcpsocket.cpp.
NTcpSocket | ( | NHostAddress & | host | ) |
NTcpSocket | ( | const NString & | host, | |
nuint16 | port | |||
) |
Creates a NTcpSocket object.
host | Hostname/ip associated with the socket | |
port | Port associated with the socket |
void setPort | ( | nint16 | port | ) |
Sets the port associated with the socket.
port | The port number associated with the socket |
Definition at line 66 of file linux/ntcpsocket.cpp.
References NAbstractSocket::m_port, and NAbstractSocket::setPort().
NHostAddress peerAddress | ( | void | ) | const |
Gets the address of the remote host.
Definition at line 218 of file linux/ntcpsocket.cpp.
References NHostAddress::setAddress().
Referenced by peerName().
NString peerName | ( | void | ) | const |
Gets the name of the remote host.
Definition at line 226 of file linux/ntcpsocket.cpp.
References peerAddress(), and NHostAddress::toString().
nuint16 peerPort | ( | void | ) | const |
Gets the port of the remote host.
Definition at line 231 of file linux/ntcpsocket.cpp.
NTcpSocket * waitForConnected | ( | void | ) |
Waits until a connection occurs.
Definition at line 194 of file linux/ntcpsocket.cpp.
References NAbstractSocket::m_host, NAbstractSocket::m_port, NAbstractSocket::m_timeout, NException::NETWORK, NSTR(), NTcpSocket(), NString::number(), NNetworkException::SOCKET_INIT_FAILED, and NHostAddress::toString().
nint32 read | ( | NDataStream * | buffer | ) | [virtual] |
Reads data from the socket.
buffer | Buffer to save the received data |
Implements NAbstractSocket.
Definition at line 236 of file linux/ntcpsocket.cpp.
References NDataStream::append(), NAbstractSocket::m_host, NIODevice::m_readBufferSize, NAbstractSocket::m_timeout, NException::NETWORK, NNetworkException::SOCK_ERROR, and NHostAddress::toString().
nint32 read | ( | NDataStream * | buffer, | |
nuint32 | bytes = 0 | |||
) | [virtual] |
Reads data from the socket.
buffer | Buffer to save the received data | |
bytes | Max number of bytes to read |
Implements NAbstractSocket.
Definition at line 288 of file linux/ntcpsocket.cpp.
References NDataStream::append(), NAbstractSocket::m_host, NAbstractSocket::m_timeout, NException::NETWORK, NNetworkException::SOCK_ERROR, and NHostAddress::toString().
nint32 readLine | ( | NDataStream * | buffer | ) | [virtual] |
Reads a line from the socket.
buffer | Buffer to save the received data |
Implements NAbstractSocket.
Definition at line 341 of file linux/ntcpsocket.cpp.
References NDataStream::append(), NAbstractSocket::m_host, NAbstractSocket::m_timeout, NException::NETWORK, NDebug::print(), NNetworkException::SOCK_ERROR, and NHostAddress::toString().
nint32 write | ( | const NDataStream & | data, | |
nuint32 | bytes = 0 | |||
) | [virtual] |
Writes data to the socket.
data | Data to be written to the socket | |
bytes | Max number of bytes to write to the socket |
Implements NAbstractSocket.
Definition at line 399 of file linux/ntcpsocket.cpp.
References NDataStream::data(), and NDataStream::size().
nint32 writeLine | ( | const NDataStream & | data, | |
nuint32 | bytes = 0 | |||
) | [virtual] |
Writes a line of data to the socket.
data | Data to be written to the socket | |
bytes | Max number of bytes to write to the socket |
Implements NAbstractSocket.
Definition at line 408 of file linux/ntcpsocket.cpp.
References NDataStream::data(), and NDataStream::size().
void setPort | ( | nint16 | port | ) |
Sets the port associated with the socket.
port | The port number associated with the socket |
NHostAddress peerAddress | ( | void | ) | const |
Gets the address of the remote host.
NString peerName | ( | void | ) | const |
Gets the name of the remote host.
nuint16 peerPort | ( | void | ) | const |
Gets the port of the remote host.
NTcpSocket* waitForConnected | ( | void | ) |
Waits until a connection occurs.
nint32 read | ( | NDataStream * | buffer | ) | [virtual] |
Reads data from the socket.
buffer | Buffer to save the received data |
Implements NAbstractSocket.
nint32 read | ( | NDataStream * | buffer, | |
nuint32 | bytes | |||
) | [virtual] |
Reads data from the socket.
buffer | Buffer to save the received data | |
bytes | Max number of bytes to read |
Implements NAbstractSocket.
nint32 readLine | ( | NDataStream * | buffer | ) | [virtual] |
Reads a line from the socket.
buffer | Buffer to save the received data |
Implements NAbstractSocket.
nint32 write | ( | const NDataStream & | data, | |
nuint32 | bytes = 0 | |||
) | [virtual] |
Writes data to the socket.
data | Data to be written to the socket | |
bytes | Max number of bytes to write to the socket |
Implements NAbstractSocket.
nint32 writeLine | ( | const NDataStream & | data, | |
nuint32 | bytes = 0 | |||
) | [virtual] |
Writes a line of data to the socket.
data | Data to be written to the socket | |
bytes | Max number of bytes to write to the socket |
Implements NAbstractSocket.