hostile-takeover/base/socketserver.cpp
2014-07-06 17:47:28 -07:00

36 lines
771 B
C++

#include "base/socketserver.h"
#include "base/socket.h"
namespace base {
// Convenient helpers (not necessary, but nice to have)
Socket *SocketServer::CreateSocket(int type, SocketNotify *notify) {
Socket *socket = new Socket(this);
if (socket->Create(type, notify)) {
return socket;
}
delete socket;
return NULL;
}
Socket *SocketServer::WrapSocket(int s, SocketNotify *notify) {
Socket *socket = new Socket(this);
if (socket->Attach(s, notify)) {
return socket;
}
delete socket;
return NULL;
}
// Can't put this in the include file because of class definition ordering issues
void Dispatcher::OnEvent(dword ff) {
if (dispatchee_ != NULL) {
dispatchee_->OnEvent(ff);
}
}
} // namespace base