libsocket
dgramclient.hpp
Go to the documentation of this file.
1 #ifndef LIBSOCKET_DGRAMCLIENT_H_A6969EEDFC57408B89EA3E965C00E811
2 #define LIBSOCKET_DGRAMCLIENT_H_A6969EEDFC57408B89EA3E965C00E811
3 
4 #include <string.h>
5 #include <unistd.h>
6 #include <string>
7 #include "socket.hpp"
8 
41 namespace libsocket {
42 using std::string;
43 
53 class dgram_client_socket : public virtual socket {
54  protected:
55  bool connected;
56 
60  public:
61  dgram_client_socket(void);
62 
64  const char* str);
66  const string& str);
67 
68  ssize_t snd(const void* buf, size_t len, int flags = 0); // flags: send()
69 
70  // I
72  string& dest);
73 
74  ssize_t rcv(void* buf, size_t len, int flags = 0);
75 
76  // @deprecated
77  bool getconn(void) const;
78 
79  bool is_connected(void) const;
80 };
81 
85 } // namespace libsocket
86 #endif
Contains libsocket elements.
Definition: dgramclient.hpp:41
ssize_t snd(const void *buf, size_t len, int flags=0)
Send data to connected socket.
Represents a generic "client" datagram socket, i.e. a datagram socket which can be connected.
Definition: dgramclient.hpp:53
socket is the base class of every other libsocket++ object.
Definition: socket.hpp:71
ssize_t rcv(void *buf, size_t len, int flags=0)
Receive data from a connected DGRAM socket.
Definition: dgramclient.cpp:73
friend dgram_client_socket & operator>>(dgram_client_socket &sock, string &dest)
Receive data from connected datagram socket.
Definition: dgramclient.cpp:95
friend dgram_client_socket & operator<<(dgram_client_socket &sock, const char *str)
Send data to connected peer.