4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.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();
54 senf::TCPv4SocketProtocol::init_client(INet4SocketAddress const & address)
58 clientHandle().connect(address);
61 prefix_ void senf::TCPv4SocketProtocol::init_server()
64 int sock = ::socket(PF_INET,SOCK_STREAM,0);
66 throw SystemException();
70 prefix_ void senf::TCPv4SocketProtocol::init_server(INet4SocketAddress const & address,
75 serverHandle().bind(address);
77 if (::listen(fd(),backlog) < 0)
78 throw SystemException();
81 ///////////////////////////////////////////////////////////////////////////
82 // senf::TCPv6SocketProtocol::
84 prefix_ void senf::TCPv6SocketProtocol::init_client()
87 int sock = ::socket(PF_INET6,SOCK_STREAM,0);
89 throw SystemException();
94 senf::TCPv6SocketProtocol::init_client(INet6SocketAddress const & address)
98 clientHandle().connect(address);
101 prefix_ void senf::TCPv6SocketProtocol::init_server()
104 int sock = ::socket(PF_INET6,SOCK_STREAM,0);
106 throw SystemException();
110 prefix_ void senf::TCPv6SocketProtocol::init_server(INet6SocketAddress const & address,
115 serverHandle().bind(address);
117 if (::listen(fd(),backlog) < 0)
118 throw SystemException();
121 ///////////////////////////////cc.e////////////////////////////////////////
123 //#include "TCPSocketHandle.mpp"
129 // c-file-style: "senf"
130 // indent-tabs-mode: nil
131 // ispell-local-dictionary: "american"
132 // compile-command: "scons -u test"
133 // comment-column: 40