|
|
|
|
|
|
Modules Namespace List Class Hierarchy Alphabetical List Compound List Namespace Members Compound Members Related Pages
acdk::net::TCPSocket Class Reference#include <TCPSocket.h>
Inheritance diagram for acdk::net::TCPSocket:
List of all members.
Detailed Description
API: Java.
- Author:
- Maximilian Thoran, Roger Kommer
- Version:
- Revision
- 1.20
- Date:
- Date
- 2005/04/30 14:06:55
|
Public Member Functions |
| TCPSocket () |
virtual | ~TCPSocket () |
virtual bool | accept (IN(RSocketImpl) s, int timeOut=-1) |
| Accepts a connection.
|
virtual int | available () |
| Returns the number of bytes that can be read from this socket without blocking.
|
virtual void | bind (IN(RInetAddress) host, int port) |
| Binds this socket to the specified port number on the specified host.
|
virtual void | close () |
| Closes this socket.
|
virtual bool | connect (IN(RInetAddress) address, int port, int timeOut=-1) |
| Connects this socket to the specified port number on the specified host.
|
virtual bool | connect (IN(RString) host, int port, int timeOut=-1) |
| Connects this socket to the specified port on the named host.
|
virtual void | create (bool stream) |
| Creates either a stream or a datagram socket.
|
RInetAddress | getInetAddress () |
| Returns the value of this socket's address field.
|
int | getLocalPort () |
| Returns the value of this socket's localport field.
|
virtual RReader | getInputStream () |
| Returns an input stream for this socket.
|
virtual RWriter | getOutputStream () |
| Returns an output stream for this socket.
|
virtual void | listen (int backlog) |
| Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.
|
virtual jlong | seek (::acdk::io::SeekPos seekrel, jlong seekpos) |
virtual jlong | skip (jlong n) |
| Move forwart into the stream.
|
virtual int | read () |
| read a single byte from stream
|
virtual int | read (IN(RbyteArray) buffer, int offset=0, int len=-1) |
| read the len bytes into buffer at offset of the buffer
|
virtual int | read (byte *buffer, int offset, int len) |
virtual void | mark (int readAheadLimit) |
virtual bool | markSupported () |
virtual void | reset () |
| if mark is set, set stream to mark point otherwise to begin of this stream.
|
virtual bool | ready () |
virtual void | flush () |
virtual void | write (const byte *cstr, int offset, int len) |
virtual void | write (byte c) |
| default implementation: byte cbuf[2]; cbuf[1] = 0; cbuf[0] = c; return write((const byte*)cbuf, 0, 1);
|
virtual void | write (IN(RbyteArray) ch, int offset=0, int len=-1) |
| Uses write(byte c) to write bytes.
|
virtual RString | getDeviceName () |
virtual bool | isWriteable () |
virtual bool | isReadable () |
virtual bool | isConnected () |
void | send (IN(RDatagramPacket) packet) |
void | receive (IN(RDatagramPacket) packet) |
void | setSoTimeout (int timeOut) |
int | getSoTimeout () |
bool | isBound () |
int | getSetSocketErrno (int newErrno=0) |
| return errno.
|
Static Public Member Functions |
void | inetSocketAddress2native (IN(RInetSocketAddress) isa, sockaddr_in &_address) |
RInetSocketAddress | native2InetSocketAddress (const sockaddr_in &_address) |
Private Member Functions |
void | _resolveLocalPortAddress () |
Private Attributes |
bool | _connected |
bool | _eof |
bool | _eofReturned |
bool | _bound |
sockaddr_in | _address |
Constructor & Destructor Documentation
acdk::net::TCPSocket::TCPSocket |
( |
|
) |
|
|
virtual acdk::net::TCPSocket::~TCPSocket |
( |
|
) |
[virtual] |
|
Member Function Documentation
void acdk::net::TCPSocket::_resolveLocalPortAddress |
( |
|
) |
[private] |
|
virtual bool acdk::net::TCPSocket::accept |
( |
IN(RSocketImpl) |
s, |
|
|
int |
timeOut = -1 |
|
) |
[virtual] |
|
virtual int acdk::net::TCPSocket::available |
( |
|
) |
[virtual] |
|
|
Returns the number of bytes that can be read from this socket without blocking.
Reimplemented from acdk::io::Reader. |
virtual void acdk::net::TCPSocket::bind |
( |
IN(RInetAddress) |
host, |
|
|
int |
port |
|
) |
[virtual] |
|
virtual void acdk::net::TCPSocket::close |
( |
|
) |
[virtual] |
|
virtual bool acdk::net::TCPSocket::connect |
( |
IN(RString) |
host, |
|
|
int |
port, |
|
|
int |
timeOut = -1 |
|
) |
[virtual] |
|
virtual bool acdk::net::TCPSocket::connect |
( |
IN(RInetAddress) |
address, |
|
|
int |
port, |
|
|
int |
timeOut = -1 |
|
) |
[virtual] |
|
|
Connects this socket to the specified port number on the specified host.
- Parameters:
-
address | the address to connect |
port | the port to connect |
timeOut | timeout in milliseconds. if timeOut == -1 block forever |
- Returns:
- true if connected. false in case of timeout
Implements acdk::net::SocketImpl. |
virtual void acdk::net::TCPSocket::create |
( |
bool |
stream |
) |
[virtual] |
|
virtual void acdk::net::TCPSocket::flush |
( |
|
) |
[virtual] |
|
virtual RString acdk::net::TCPSocket::getDeviceName |
( |
|
) |
[inline, virtual] |
|
RInetAddress acdk::net::TCPSocket::getInetAddress |
( |
|
) |
[virtual] |
|
virtual RReader acdk::net::TCPSocket::getInputStream |
( |
|
) |
[virtual] |
|
int acdk::net::TCPSocket::getLocalPort |
( |
|
) |
[virtual] |
|
virtual RWriter acdk::net::TCPSocket::getOutputStream |
( |
|
) |
[virtual] |
|
int acdk::net::TCPSocket::getSetSocketErrno |
( |
int |
newErrno = 0 |
) |
|
|
|
return errno.
if newErrno == -1 the errno will not be set |
int acdk::net::TCPSocket::getSoTimeout |
( |
|
) |
|
|
void acdk::net::TCPSocket::inetSocketAddress2native |
( |
IN(RInetSocketAddress) |
isa, |
|
|
sockaddr_in & |
_address |
|
) |
[static] |
|
bool acdk::net::TCPSocket::isBound |
( |
|
) |
[inline] |
|
virtual bool acdk::net::TCPSocket::isConnected |
( |
|
) |
[inline, virtual] |
|
virtual bool acdk::net::TCPSocket::isReadable |
( |
|
) |
[inline, virtual] |
|
virtual bool acdk::net::TCPSocket::isWriteable |
( |
|
) |
[inline, virtual] |
|
virtual void acdk::net::TCPSocket::listen |
( |
int |
backlog |
) |
[virtual] |
|
|
Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.
Implements acdk::net::SocketImpl. |
virtual void acdk::net::TCPSocket::mark |
( |
int |
readAheadLimit |
) |
[inline, virtual] |
|
virtual bool acdk::net::TCPSocket::markSupported |
( |
|
) |
[inline, virtual] |
|
RInetSocketAddress acdk::net::TCPSocket::native2InetSocketAddress |
( |
const sockaddr_in & |
_address |
) |
[static] |
|
virtual int acdk::net::TCPSocket::read |
( |
byte * |
buffer, |
|
|
int |
offset, |
|
|
int |
len |
|
) |
[virtual] |
|
virtual int acdk::net::TCPSocket::read |
( |
IN(RbyteArray) |
buffer, |
|
|
int |
offset = 0, |
|
|
int |
len = -1 |
|
) |
[virtual] |
|
|
read the len bytes into buffer at offset of the buffer
- Parameters:
-
buffer | where to write the bytes |
offset | offset to write into buffer |
len | how many bytes to read. if == -1 read into many bytes, that fits into buffer (buffer->length() - offset) `` |
- Returns:
- number of bytes readed. may less than input if EOS is reached
- Exceptions:
-
EOF | exception, if trying to read behind EOS |
Reimplemented from acdk::io::Reader. |
virtual int acdk::net::TCPSocket::read |
( |
|
) |
[virtual] |
|
|
read a single byte from stream
- Returns:
- the byte readed or -1 if EOS.
- Exceptions:
-
EOF | exception, if trying to read behind EOS |
Reimplemented from acdk::io::Reader. |
virtual bool acdk::net::TCPSocket::ready |
( |
|
) |
[virtual] |
|
|
- Returns:
- true, if at least 1 byte can be readed from stream
Reimplemented from acdk::io::Reader. |
virtual void acdk::net::TCPSocket::reset |
( |
|
) |
[virtual] |
|
|
if mark is set, set stream to mark point otherwise to begin of this stream.
Implements acdk::io::Reader. |
void acdk::net::TCPSocket::setSoTimeout |
( |
int |
timeOut |
) |
|
|
virtual jlong acdk::net::TCPSocket::skip |
( |
jlong |
n |
) |
[virtual] |
|
|
Move forwart into the stream.
- Returns:
- how many bytes skipped. May less then input, in case EOS is reached
Implements acdk::io::Reader. |
virtual void acdk::net::TCPSocket::write |
( |
IN(RbyteArray) |
ch, |
|
|
int |
offset = 0, |
|
|
int |
len = -1 |
|
) |
[virtual] |
|
virtual void acdk::net::TCPSocket::write |
( |
byte |
c |
) |
[virtual] |
|
|
default implementation: byte cbuf[2]; cbuf[1] = 0; cbuf[0] = c; return write((const byte*)cbuf, 0, 1);
Implements acdk::io::Writer. |
virtual void acdk::net::TCPSocket::write |
( |
const byte * |
cstr, |
|
|
int |
offset, |
|
|
int |
len |
|
) |
[virtual] |
|
Member Data Documentation
|
|