NetSocket++
0.1
A library designed to simplify working with UNIX sockets in C++, written in OOP methodology.
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
NetSocket.h
Go to the documentation of this file.
1
#ifndef _NETSOCKET_H
2
#define _NETSOCKET_H
3
#include <sys/socket.h>
4
#include <sys/types.h>
5
#include <arpa/inet.h>
6
#include <netdb.h>
7
#include <unistd.h>
8
#include <sys/wait.h>
9
#include <signal.h>
10
#include <string>
11
#include <cerrno>
12
#include <cstring>
18
21
namespace
NetSocketPP {
26
inline
std::string
CStrToString
(
char
* cstr) {
27
std::string str =
""
;
28
for
(
int
i = 0; cstr[i] !=
'\000'
; i++) {
29
str += cstr[i];
30
}
31
return
str;
32
}
35
class
NetSocket
{
36
protected
:
37
int
_descriptor
;
38
int
_yes
;
39
int
_status
;
40
char
_caddr
[INET6_ADDRSTRLEN];
41
addrinfo
_hints
;
42
addrinfo *
_servinfo
;
43
sockaddr_storage
_their_addr
;
44
socklen_t
_addr_size
;
45
std::string
_host
;
46
std::string
_service
;
47
std::string
_protocol
;
48
void
*
get_in_addr
(sockaddr* sa);
49
public
:
50
NetSocket
(std::string host, std::string service, std::string protocol);
51
52
53
54
std::string
getIP
();
55
56
int
getDesc
();
57
58
~NetSocket
();
59
};
60
}
61
#endif
Generated on Wed Feb 27 2013 00:04:34 for NetSocket++ by
1.8.3.1