[haiku-commits] Re: haiku: hrev46172 - in docs/user: net locale

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 04 Oct 2013 22:49:13 +0200

Am 04/10/2013 16:57, schrieb pulkomandy@xxxxxxxxxxxxx:
+       New subclasses of BAbstractSocket may be created to allow communication
+       using more protocols.

The only thing that is really missing (I have a draft of that API) is a BServerSocket class. Apart from that, the existing classes are protocol agnostic. The BAbstractSocket is more of an implementation detail than something you'll ever feel like subclassing.

+       \fn BAbstractSocket::BAbstractSocket()
+       \brief Default constructor.
+
+       The socket is disconnected and unbound, and the status is B_NO_INIT.
+       Use Bind or Connect to initialize it.

That sounds as if the socket is actively disconnected. How about "After construction, the socket is in disconnected and unbound state."

+       \brief Copy constructor
+
+       There is no new connection to the server. Instead, data sent using 
several
+       copy of the class will be intermixed, and the first instance to read 
data
+       will steal it from the others.
+
+       This is probably not what you want, unless you work with datagrams. In
+       that case, the messages read and written are atomic and can be safely 
sent
+       and received from different places.

Besides the grammatical and logical issues (you copy objects not classes, and the plural of copy is copies), this is described overly complex. How about "The copied object accesses the same underlying socket." The "this is probably not what you want" part does not really make any sense: it completely depends on the context. Just consider the following function signature:
        BAbstractSocket Open();

> +  \fn BAbstractSocket::~BAbstractSocket()
> +  Disconnects the socket by calling Disconnect().

This is actually a flaw in the API design, as Disconnect() is virtual; the base class will always call the base Disconnect(), however. I guess it would be better to drop the virtual, or simply not call it in the base destructor.

Bye,
   Axel.


Other related posts: