libsocket
inetclientstream.hpp
Go to the documentation of this file.
1 #ifndef LIBSOCKET_INETCLIENTSTREAM_H_64300E32D2CB4AD99D557F79F8D340CA
2 #define LIBSOCKET_INETCLIENTSTREAM_H_64300E32D2CB4AD99D557F79F8D340CA
3 
4 #include <sys/socket.h>
5 #include <sys/types.h>
6 #include <string>
7 
8 #include "inetbase.hpp"
9 #include "streamclient.hpp"
10 
16 /*
17  The committers of the libsocket project, all rights reserved
18  (c) 2012, dermesser <lbo@spheniscida.de>
19 
20  Redistribution and use in source and binary forms, with or without
21  modification, are permitted provided that the following conditions are met:
22 
23  1. Redistributions of source code must retain the above copyright notice,
24  this list of conditions and the following disclaimer.
25  2. Redistributions in binary form must reproduce the above copyright notice,
26  this list of conditions and the following disclaimer in the documentation
27  and/or other materials provided with the distribution.
28 
29  THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS “AS IS” AND ANY
30  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
33  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 
40 */
41 
42 namespace libsocket {
43 using std::string;
44 
55  public:
56  inet_stream(void);
57  inet_stream(const char* dsthost, const char* dstport, int proto_osi3,
58  int flags = 0); // flags: socket()
59  inet_stream(const string& dsthost, const string& dstport, int proto_osi3,
60  int flags = 0);
61 
62  void connect(const char* dsthost, const char* dstport, int proto_osi3,
63  int flags = 0); // flags: socket()
64  void connect(const string& dsthost, const string& dstport, int proto_osi3,
65  int flags = 0);
66 
67  friend class inet_stream_server;
68 };
75 } // namespace libsocket
76 #endif
Contains libsocket elements.
Definition: dgramclient.hpp:41
Provides TCP/IP client sockets. This class is the most used socket class in libsocket++....
void connect(const char *dsthost, const char *dstport, int proto_osi3, int flags=0)
Set up socket if not already done.
Internet-socket base class This class provides some fields for all internet sockets,...
Definition: inetbase.hpp:52
Generic socket for active stream sockets (TCP client sockets, UNIX Stream clients)
TCP server socket (passive TCP socket)
inet_stream(void)
Void constructor; call connect() before using the socket!