diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-02-22 16:01:54 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-02-22 16:01:54 +0000 |
| commit | 44beebd257b0fb265bea5387850b9beb33c0adc2 (patch) | |
| tree | 0ec08e4aad18ccff2d578aca1c0b3799d2716c6c /src/Socket.cc | |
| parent | d027ca8e7c383e9755d6fb997e8a880df99e88b9 (diff) | |
| parent | 87a229cab18679042beb06076e5dec1dcfadaeae (diff) | |
Tagging release 0.2.0 of aria2release-0.2.0
Diffstat (limited to 'src/Socket.cc')
| -rw-r--r-- | src/Socket.cc | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/src/Socket.cc b/src/Socket.cc index bf9a04f1..f4e0862d 100644 --- a/src/Socket.cc +++ b/src/Socket.cc @@ -30,6 +30,10 @@ Socket::Socket(const Socket& s) { core->use++; } +Socket::Socket(SocketCore* core) { + this->core = core; +} + Socket::~Socket() { core->use--; if(core->use == 0) { @@ -49,38 +53,54 @@ Socket& Socket::operator=(const Socket& s) { return *this; } -void Socket::establishConnection(string host, int port) { +void Socket::beginListen() const { + core->beginListen(); +} + +void Socket::getAddrInfo(pair<string, int>& addrinfo) const { + core->getAddrInfo(addrinfo); +} + +Socket* Socket::acceptConnection() const { + return new Socket(core->acceptConnection()); +} + +void Socket::establishConnection(string host, int port) const { core->establishConnection(host, port); } -void Socket::setNonBlockingMode() { - core->setNonBlockingMode(); +void Socket::setBlockingMode() const { + core->setBlockingMode(); } -void Socket::closeConnection() { +void Socket::closeConnection() const { core->closeConnection(); } -bool Socket::isWritable(int timeout) { +bool Socket::isWritable(int timeout) const { return core->isWritable(timeout); } -bool Socket::isReadable(int timeout) { +bool Socket::isReadable(int timeout) const { return core->isReadable(timeout); } -void Socket::writeData(const char* data, int len, int timeout) { +void Socket::writeData(const char* data, int len, int timeout) const { core->writeData(data, len, timeout); } -void Socket::readData(char* data, int& len, int timeout) { +void Socket::writeData(string str, int timeout) const { + core->writeData(str.c_str(), str.size(), timeout); +} + +void Socket::readData(char* data, int& len, int timeout) const { core->readData(data, len, timeout); } -void Socket::peekData(char* data, int& len, int timeout) { +void Socket::peekData(char* data, int& len, int timeout) const { core->peekData(data, len, timeout); } -void Socket::initiateSecureConnection() { +void Socket::initiateSecureConnection() const { core->initiateSecureConnection(); } |
