Build a connection as client or server. You may either pass an prepared socket object or parameters to initiate one. All %options which start with capitals are passed to the socket creation. See extractSocket() for those additional %options.

For sockets, this does not nessecarily mean that the descriptor has been closed, as the other end of a socket could have used shutdown() to close just half of the socket, leaving us free to write data back down the still open half.

example:

In this example, we send a final reply to the other end of the socket, and then shut it down for writing. Since it is also shut down for reading (implicly by the EOF condition), it will be closed once the output has been sent, after which the close() callback will be called.