summaryrefslogtreecommitdiff
path: root/src/Socket.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2006-02-21 12:27:17 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2006-02-21 12:27:17 +0000
commit5a8710676d58be3b3f3606993e802c6a075dbd89 (patch)
tree634e1f7be2dffb00c4248323c1465f22aedb6f60 /src/Socket.cc
parent6d6f25b75c1557f2b92e51fe589aadc48a1fdb68 (diff)
Diffstat (limited to 'src/Socket.cc')
-rw-r--r--src/Socket.cc40
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();
}