Skip to content
Browse files

Improved doc: Added unixserverdgram, unixclientdgram

  • Loading branch information...
1 parent b8d54b8 commit 98d479d0077592d256b8ebeb42e7ecfcb4169f9d @dermesser committed Jun 25, 2012
Showing with 139 additions and 10 deletions.
  1. +2 −0 C++/unixserverdgram.cpp
  2. +74 −5 doc/libsocket++/DOCUMENTATION++.html
  3. +63 −5 doc/libsocket++/DOCUMENTATION++.md
View
2 C++/unixserverdgram.cpp
@@ -76,6 +76,8 @@ namespace libsocket
if ( sfd < 0 )
throw socket_exception(__FILE__,__LINE__,"unix_dgram_server::setup: Could not create server!\n");
+
+ bound = true;
}
void unix_dgram_server::setup(const string& bindpath, int socket_flags)
View
79 doc/libsocket++/DOCUMENTATION++.html
@@ -167,7 +167,7 @@
<h3>Output/Upload Functions</h3>
-<p>Declared in <code>inetclientstream.hpp</code>, defined in <code>inetclientstream.cpp</code></p>
+<p>Inherited from <code>stream_client_socket</code></p>
<pre><code>ssize_t snd(const void* buf, size_t len, int flags=0);
</code></pre>
@@ -324,7 +324,6 @@
<p>Defined in <code>inetdgram.cpp</code></p>
<pre><code>1: ssize_t sndto(const void* buf, size_t len, const char* host, const char* port, int sndto_flags=0);
-
2: ssize_t sndto(const void* buf, size_t len, const std::string&amp; host, const std::string&amp; port, int sndto_flags=0)
</code></pre>
@@ -442,10 +441,10 @@
<p>Defined in <code>streamclient.cpp</code>, inherited from <code>stream_client_socket</code></p>
-<pre><code> friend stream_client_socket&amp; operator&lt;&lt;(stream_client_socket&amp; sock, const char* str);
- friend stream_client_socket&amp; operator&lt;&lt;(stream_client_socket&amp; sock, string&amp; str);
+<pre><code>friend stream_client_socket&amp; operator&lt;&lt;(stream_client_socket&amp; sock, const char* str);
+friend stream_client_socket&amp; operator&lt;&lt;(stream_client_socket&amp; sock, string&amp; str);
- friend stream_client_socket&amp; operator&gt;&gt;(stream_client_socket&amp; sock, string&amp; dest);
+friend stream_client_socket&amp; operator&gt;&gt;(stream_client_socket&amp; sock, string&amp; dest);
</code></pre>
<p>Like the normal file stream operators. <code>unix_stream_client</code> is a child of `stream<em>client</em>socket´.</p>
@@ -488,3 +487,73 @@
<p>Accept a new connection on the socket. <code>flags</code> are passed to <code>accept4(2)</code>. Returns a pointer to a dynamically allocated
<code>unix_stream_client</code> object. It's recommended, especially for long-running applications, to call <code>delete</code> on this pointer
when it isn't needed anymore.</p>
+
+<h2><code>unix_dgram_client</code></h2>
+
+<p>Defined in <code>unixclientdgram.cpp</code></p>
+
+<pre><code>unix_dgram_client(int flags=0);
+unix_dgram_client(const char* path, int flags=0);
+unix_dgram_client(const string&amp; path, int flags=0);
+</code></pre>
+
+<p>Create a UNIX DGRAM socket. If you use the second or third constructor, bind it additionally to path.</p>
+
+<h1><code>connect()</code>, <code>deconnect()</code></h1>
+
+<p>Defined in <code>unixclientdgram.cpp</code></p>
+
+<pre><code>void connect(const char* path);
+void connect(const string&amp; path);
+</code></pre>
+
+<p>Connect the DGRAM socket to the specified path. You may call <code>snd()</code> or <code>rcv()</code> on a UNIX DGRAM socket if it's connected.</p>
+
+<pre><code>void deconnect(void);
+</code></pre>
+
+<p>Disconnect the DGRAM socket. (Connect it to NULL).</p>
+
+<h2>I/O</h2>
+
+<p>Inherited from <code>dgram_client_socket</code></p>
+
+<pre><code>friend dgram_client_socket&amp; operator&lt;&lt;(dgram_client_socket&amp; sock, const char* str);
+friend dgram_client_socket&amp; operator&lt;&lt;(dgram_client_socket&amp; sock, string&amp; str);
+friend dgram_client_socket&amp; operator&gt;&gt;(dgram_client_socket&amp; sock, string&amp; dest);
+
+ssize_t snd(const void* buf, size_t len, int flags=0); // flags: send()
+ssize_t rcv(void* buf, size_t len, int flags=0);
+</code></pre>
+
+<p>Inherited from <code>unix_dgram</code></p>
+
+<pre><code>ssize_t sndto(const void* buf, size_t length, const char* path, int sendto_flags=0);
+ssize_t sndto(const void* buf, size_t length, const string&amp; path, int sendto_flags=0);
+
+ssize_t rcvfrom(void* buf, size_t length, char* source, size_t source_len, int recvfrom_flags=0);
+ssize_t rcvfrom(void* buf, size_t length, string&amp; source, int recvfrom_flags=0);
+</code></pre>
+
+<h2><code>unix_dgram_server</code></h2>
+
+<p>Defined in <code>unixserverdgram.cpp</code></p>
+
+<pre><code>unix_dgram_server(void);
+unix_dgram_server(const char* bindpath, int socket_flags=0);
+unix_dgram_server(const string&amp; bindpath, int socket_flags=0);
+</code></pre>
+
+<p><code>unix_dgram_server</code> is quite similar to <code>unix_dgram_client</code>, especially if bound. The important difference is that
+you may not call <code>connect()</code> on <code>unix_dgram_server</code>.</p>
+
+<h2>I/O</h2>
+
+<p>Defined in <code>unixdgram.cpp</code></p>
+
+<pre><code>ssize_t sndto(const void* buf, size_t length, const char* path, int sendto_flags=0);
+ssize_t sndto(const void* buf, size_t length, const string&amp; path, int sendto_flags=0);
+
+ssize_t rcvfrom(void* buf, size_t length, char* source, size_t source_len, int recvfrom_flags=0);
+ssize_t rcvfrom(void* buf, size_t length, string&amp; source, int recvfrom_flags=0);
+</code></pre>
View
68 doc/libsocket++/DOCUMENTATION++.md
@@ -144,7 +144,7 @@ Close the socket and destroy the connection.
Return value 0 if successfull, otherwise -1.
### Output/Upload Functions
-Declared in `inetclientstream.hpp`, defined in `inetclientstream.cpp`
+Inherited from `stream_client_socket`
ssize_t snd(const void* buf, size_t len, int flags=0);
@@ -277,7 +277,6 @@ to the connected peer. `flags` may be specified and take the flags described in
Defined in `inetdgram.cpp`
1: ssize_t sndto(const void* buf, size_t len, const char* host, const char* port, int sndto_flags=0);
-
2: ssize_t sndto(const void* buf, size_t len, const std::string& host, const std::string& port, int sndto_flags=0)
1, 2: Send `len` bytes from `buf` to `host`:`port`. `sndto_flags` may be specified and take the flags described
@@ -375,10 +374,10 @@ Defined in `streamclient.cpp`, inherited from `stream_client_socket`
### Stream operators
Defined in `streamclient.cpp`, inherited from `stream_client_socket`
- friend stream_client_socket& operator<<(stream_client_socket& sock, const char* str);
- friend stream_client_socket& operator<<(stream_client_socket& sock, string& str);
+ friend stream_client_socket& operator<<(stream_client_socket& sock, const char* str);
+ friend stream_client_socket& operator<<(stream_client_socket& sock, string& str);
- friend stream_client_socket& operator>>(stream_client_socket& sock, string& dest);
+ friend stream_client_socket& operator>>(stream_client_socket& sock, string& dest);
Like the normal file stream operators. `unix_stream_client` is a child of `stream_client_socket´.
@@ -415,3 +414,62 @@ Accept a new connection on the socket. `flags` are passed to `accept4(2)`. Retur
`unix_stream_client` object. It's recommended, especially for long-running applications, to call `delete` on this pointer
when it isn't needed anymore.
+##`unix_dgram_client`
+Defined in `unixclientdgram.cpp`
+
+ unix_dgram_client(int flags=0);
+ unix_dgram_client(const char* path, int flags=0);
+ unix_dgram_client(const string& path, int flags=0);
+
+Create a UNIX DGRAM socket. If you use the second or third constructor, bind it additionally to path.
+
+#`connect()`, `deconnect()`
+Defined in `unixclientdgram.cpp`
+
+ void connect(const char* path);
+ void connect(const string& path);
+
+Connect the DGRAM socket to the specified path. You may call `snd()` or `rcv()` on a UNIX DGRAM socket if it's connected.
+
+ void deconnect(void);
+
+Disconnect the DGRAM socket. (Connect it to NULL).
+
+##I/O
+Inherited from `dgram_client_socket`
+
+ friend dgram_client_socket& operator<<(dgram_client_socket& sock, const char* str);
+ friend dgram_client_socket& operator<<(dgram_client_socket& sock, string& str);
+ friend dgram_client_socket& operator>>(dgram_client_socket& sock, string& dest);
+
+ ssize_t snd(const void* buf, size_t len, int flags=0); // flags: send()
+ ssize_t rcv(void* buf, size_t len, int flags=0);
+
+Inherited from `unix_dgram`
+
+ ssize_t sndto(const void* buf, size_t length, const char* path, int sendto_flags=0);
+ ssize_t sndto(const void* buf, size_t length, const string& path, int sendto_flags=0);
+
+ ssize_t rcvfrom(void* buf, size_t length, char* source, size_t source_len, int recvfrom_flags=0);
+ ssize_t rcvfrom(void* buf, size_t length, string& source, int recvfrom_flags=0);
+
+
+##`unix_dgram_server`
+Defined in `unixserverdgram.cpp`
+
+ unix_dgram_server(void);
+ unix_dgram_server(const char* bindpath, int socket_flags=0);
+ unix_dgram_server(const string& bindpath, int socket_flags=0);
+
+`unix_dgram_server` is quite similar to `unix_dgram_client`, especially if bound. The important difference is that
+you may not call `connect()` on `unix_dgram_server`.
+
+##I/O
+Defined in `unixdgram.cpp`
+
+ ssize_t sndto(const void* buf, size_t length, const char* path, int sendto_flags=0);
+ ssize_t sndto(const void* buf, size_t length, const string& path, int sendto_flags=0);
+
+ ssize_t rcvfrom(void* buf, size_t length, char* source, size_t source_len, int recvfrom_flags=0);
+ ssize_t rcvfrom(void* buf, size_t length, string& source, int recvfrom_flags=0);
+

0 comments on commit 98d479d

Please sign in to comment.
Something went wrong with that request. Please try again.