nabstractsocket.cpp

00001 // LICENSE: (Please see the file COPYING for details)
00002 //
00003 // NUS - Nemesis Utilities System: A C++ application development framework 
00004 // Copyright (C) 2006, 2008 Otavio Rodolfo Piske
00005 //
00006 //  This file is part of NUS
00007 //
00008 //  This library is free software; you can redistribute it and/or
00009 //  modify it under the terms of the GNU Lesser General Public
00010 //  License as published by the Free Software Foundation version 2.1
00011 //  of the License.
00012 //
00013 //  This library is distributed in the hope that it will be useful,
00014 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 //  Lesser General Public License for more details.
00017 //
00018 //  You should have received a copy of the GNU Lesser General Public
00019 //  License along with this library; if not, write to the Free Software
00020 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021 //
00022 #include "nabstractsocket.h"
00023 
00024 DllDeclSpec const nint32 NAbstractSocket::DEFAULT_SOCK_OPTS = 0;
00025 DllDeclSpec const nint32 NAbstractSocket::REUSE_ADDRESS = SO_REUSEADDR;
00026 DllDeclSpec const nint32 NAbstractSocket::KEEPALIVE = SO_KEEPALIVE;
00027 
00028 NAbstractSocket::NAbstractSocket(void)
00029       : m_host(),
00030       m_port(0),
00031       m_timeout(300),
00032       m_opt(DEFAULT_SOCK_OPTS),
00033       m_maxPendingConn(5)
00034 {
00035 
00036 }
00037 
00038 
00039 NAbstractSocket::NAbstractSocket(const NHostAddress &host)
00040       : m_host(),
00041       m_port(0),
00042       m_timeout(300),
00043       m_opt(DEFAULT_SOCK_OPTS),
00044       m_maxPendingConn(5)
00045 {
00046       m_host = host.toString();
00047 }
00048 
00049 
00050 NAbstractSocket::NAbstractSocket(const NHostAddress &host, nuint16 port)
00051       : m_host(),
00052       m_port(port),
00053       m_timeout(300),
00054       m_opt(DEFAULT_SOCK_OPTS),
00055       m_maxPendingConn(5)
00056 {
00057       m_host = host.toString();
00058 }
00059 
00060 NAbstractSocket::NAbstractSocket(const NString &host, nuint16 port)
00061       : m_host(host),
00062       m_port(port),
00063       m_timeout(300),
00064       m_opt(DEFAULT_SOCK_OPTS),
00065       m_maxPendingConn(5)
00066 {
00067 
00068 }
00069 
00070 
00071 NAbstractSocket::~NAbstractSocket(void) {
00072 
00073 }
00074 
00075 void NAbstractSocket::setHost(const NHostAddress &host) {
00076       m_host = host;
00077 }
00078 
00079 
00080 void NAbstractSocket::setHost(const NString &host) {
00081       m_host = host;
00082 }
00083 
00084 
00085 NHostAddress NAbstractSocket::getHost(void) const {
00086       return m_host;
00087 }
00088 
00089 
00090 void NAbstractSocket::setPort(nuint16 port) {
00091       m_port = port;
00092 }
00093 
00094 
00095 nuint16 NAbstractSocket::getPort(void) const {
00096       return m_port;
00097 }
00098 
00099 
00100 void NAbstractSocket::setTimeout(nuint16 timeout) {
00101       m_timeout = timeout;
00102 }
00103 
00104 
00105 nuint16 NAbstractSocket::getTimeout(void) const {
00106       return m_timeout;
00107 }
00108 
00109 
00110 void NAbstractSocket::setSocketOptions(nint32 opt) { 
00111       m_opt = opt;
00112 }
00113 
00114 void NAbstractSocket::setMaxPendingConnections(nint32 max) { 
00115       m_maxPendingConn = max; 
00116 }
00117 
00118 
00119 nint32 NAbstractSocket::getMaxPendingConnections(void) const { 
00120       return m_maxPendingConn;
00121 }
00122 
00123 
00124 /*
00125 NAbstractSocket NAbstractSocket::waitForConnected(void) {
00126       return NAbstractSocket();
00127 }
00128 */

Generated on Wed Mar 5 23:10:35 2008 for NemesisUtilitiesSystem by  doxygen 1.5.4