6 #include <sys/socket.h>
55 #define SOCK_NONBLOCK O_NONBLOCK
70 setup(proto_osi3, flags);
83 int proto_osi3,
int flags) {
84 setup(dsthost, dstport, proto_osi3, flags);
97 const string& dstport,
int proto_osi3,
99 setup(dsthost, dstport, proto_osi3, flags);
111 "inet_dgram_client::inet_dgram_client() - Could "
112 "not create inet dgram socket!");
115 is_nonblocking = flags & SOCK_NONBLOCK;
128 int proto_osi3,
int flags) {
134 "inet_dgram_client::inet_dgram_client() - Could "
135 "not create inet dgram socket!");
140 is_nonblocking = flags & SOCK_NONBLOCK;
153 int proto_osi3,
int flags) {
154 setup(dsthost.c_str(), dstport.c_str(), proto_osi3, flags);
170 "inet_dgram_client::connect() - Socket has already been closed!",
175 "inet_dgram_client::connect() - Could not connect dgram socket! "
176 "(Maybe this socket has a wrong address family?)");
196 "inet_dgram_client::connect() - Socket has already been closed!",
202 "inet_dgram_client::connect() - Could not connect dgram socket! "
203 "(Maybe this socket has a wrong address family?)");
216 void inet_dgram_client::deconnect(
void) {
220 "inet_dgram_client::deconnect() - Could not disconnect!");
inet_dgram_client(int proto_osi3, int flags=0)
Create normal datagram socket (connectable).
void setup(int proto_osi3, int flags=0)
Set up normal datagram socket (connectable). [NOT FOR EXTERNAL USE].
void connect(const char *dsthost, const char *dstport)
Connect datagram socket.
string host
The address we're bound or connected to.
int proto
Which internet protocol version we're using.
string port
The port we're bound or connected to.
int sfd
sfd is the sockets API file descriptor
int connect_inet_dgram_socket(int sfd, const char *host, const char *service)
Connect a UDP socket.
int create_inet_dgram_socket(char proto_osi3, int flags)
Creates a new UDP/IP socket.
int get_address_family(const char *hostname)
Look up which address families a host supports.
Contains all functions available in the C libsocket.
Contains libsocket elements.
This class is instantiated and thrown when an error occurs. If there's an error somewhere in libsocke...