4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief TCPv4SocketHandle and TCPv6SocketHandle non-inline non-template implementation
27 #include "TCPSocketHandle.hh"
28 //#include "TCPSocketHandle.ih"
31 #include <sys/types.h>
32 #include <sys/socket.h>
33 #include <sys/ioctl.h>
35 #include "Utils/Exception.hh"
37 //#include "TCPSocketHandle.mpp"
39 ///////////////////////////////cc.p////////////////////////////////////////
41 ///////////////////////////////////////////////////////////////////////////
42 // senf::TCPv4SocketProtocol
44 prefix_ void senf::TCPv4SocketProtocol::init_client()
47 int sock = ::socket(PF_INET,SOCK_STREAM,0);
49 throw SystemException(errno);
54 senf::TCPv4SocketProtocol::init_client(INet4Address const & address)
61 prefix_ void senf::TCPv4SocketProtocol::init_server()
64 int sock = ::socket(PF_INET,SOCK_STREAM,0);
66 throw SystemException(errno);
70 prefix_ void senf::TCPv4SocketProtocol::init_server(INet4Address const & address,
77 if (::listen(body().fd(),backlog) < 0)
78 throw SystemException(errno);
81 prefix_ std::auto_ptr<senf::SocketProtocol> senf::TCPv4SocketProtocol::clone()
84 return std::auto_ptr<SocketProtocol>(new TCPv4SocketProtocol());
87 ///////////////////////////////////////////////////////////////////////////
88 // senf::TCPv6SocketProtocol::
90 prefix_ void senf::TCPv6SocketProtocol::init_client()
93 int sock = ::socket(PF_INET6,SOCK_STREAM,0);
95 throw SystemException(errno);
100 senf::TCPv6SocketProtocol::init_client(INet6SocketAddress const & address)
107 prefix_ void senf::TCPv6SocketProtocol::init_server()
110 int sock = ::socket(PF_INET6,SOCK_STREAM,0);
112 throw SystemException(errno);
116 prefix_ void senf::TCPv6SocketProtocol::init_server(INet6SocketAddress const & address,
123 if (::listen(body().fd(),backlog) < 0)
124 throw SystemException(errno);
127 prefix_ std::auto_ptr<senf::SocketProtocol> senf::TCPv6SocketProtocol::clone()
130 return std::auto_ptr<SocketProtocol>(new TCPv6SocketProtocol());
133 ///////////////////////////////cc.e////////////////////////////////////////
135 //#include "TCPSocketHandle.mpp"
141 // c-file-style: "senf"
142 // indent-tabs-mode: nil
143 // ispell-local-dictionary: "american"