Merge pull request #819 from hurtonm/master

Implement socket_base_t::get_credential member function
Fix compilation on MinGW-w64
Merge pull request #820 from jtanx/win32

Fix compilation on Windows (MinGW-w64)
use version-script only for ELF linux
Merge pull request #821 from davipt/master

use version-script only for ELF linux
Define NOMINMAN to fix windows build.
Merge pull request #823 from ricnewton/master

Define NOMINMAN to fix windows build.
Adds support for detecting ZMQ_STREAM disconnections.

When a ZMQ_STREAM socket connection is broken (intentionally, via `shutdown()`
or accidentally via client crash or network failure), there is no way for the
application to dertermine that it should drop per-connection data (such as
buffers).

This contribution makes sure the application receives a 0-length message to
notify it that the connection has been broken.  This is symmetric with the
process of closing the connection from within the application (where the
application sends a 0-length message to tell ZeroMQ to close the connection).

Conflicts:
	CMakeLists.txt
Fixes CMake build after ZAP test file was deleted.

File was removed in 5bf96f64b07ff74548495fdf38198a9cc8edb662 a few days ago.
Merge pull request #824 from AndreLouisCaron/fix-cmake-build

Fixes CMake build after ZAP test file was deleted.
Merge pull request #825 from AndreLouisCaron/disconnect-notifications

Adds support for detecting ZMQ_STREAM disconnections.
Corrects ypipe initialization when conflate is NOT enabled.

Fixes LIBZMQ-584
Update pipe.cpp
Merge pull request #827 from EricMCornelius/master

Corrects ypipe initialization when conflate is NOT enabled.
fixed cmake merge related to version.rc.in handling
Merge pull request #828 from snikulov/cmake_rc_merge_fix

fixed cmake merge related to version.rc.in handling
Store socket FD after connect
Add STREAM connect notification.
Adjust test cases to connection notification.
Increase error checking in test cases.
Both STREAM and ROUTER sockets suffer from a naming problem on outbound connections. While these connections can be created, they can't be immediately used. Traffic must be received before it can be sent. This prevents practical, minimal usage of STREAM or ROUTER as a true N fan in/out socket.

This change simply provides the user with a socket option that sets a user defined name of the next outbound connection:

zmq_setsockopt(routerSock,ZMQ_NEXT_IDENTITY,"myname",6);
if(0 > zmq_connect(routerSock,"tcp://127.0.0.1:1234")) return 1;
ret = zmq_send(routerSock,"myname",6,ZMQ_SNDMORE);
zmq_send(routerSock,b.mem,b.used,0);

In this example, the socket is immediately given the name "myname", and is capable of immediately sending traffic.

This approach is more effective in three ways:
1) It prevents all sorts of malicious peer naming attacks that can cause undefined behavior in existing ROUTER connections. (Two connections are made that both transmit the same name to the ROUTER, the ROUTER behavior is undefined)
2) It allows immediate control of connections made to external parties for STREAM sockets. Something that is not possible right now. Before an outbound connection had no name for STREAM or ROUTER sockets because outbound connections cannot be sent to without first receiving traffic.
3) It is simpler and more general than expecting two ROUTER sockets to handshake on assigned connection names. Plus it allows inline sending to new connections on ROUTER.
fixed define value in header