Basic initialization

refs NET-4

It seems to be clear that a socket of a newer type has to have support
for IPv6 and let the OS handle the mapping to IPv4 if necessary. Hence
the Socket is initialized as UDPv6 socket and is bound to a user
specified port for any address that messages com from.

The socket is also told to be not blocking, though this might be
unnecessary since this should work in an asynchronous way.
Changing listen to Open

refs NET-4

The method listen is already implemented by the socket which this class
derives from. So I had the choice to override it, but I decided to
provide an API that is specific to UDP and this projects aims.
Test adaption

The Peer Socket class has no constructor with no arguments.
More constructors and a test revert

The peer socket now offers a constructor for a specific EndPoint, just
the port or an empty one. The EndPoint version binds to the specified
Endpoint, the port one binds to any address and the specified port and
the empty one binds to any address and port 42337.

NET-4
Testing all constructors
Fixing tests

There is a new name to the first tests and the missing includes have
been added.
More fixing tests
even more tests fixing
Dummy testing the Open method

The socket has to be "opened" if the user wants to use it. In this
method we are setting up the listening for incoming messages in the
future.
Switching to managed socket

When deriving from the socket class, implicitly all its public methods
are exposed. But we want to have control over the API, thus we
encapsulate the socket and offer only relevant information.

The peer socket now finds out about the MTU of the NICs on the host.
This will determine the buffersize for the SAEA objects, since we can
not receive messages that have a bigger size then that.

Exposing exceptions is avoided by catching them all in the required
places.

NET-4, NET-9
Additional information for tests

I added some messages with information about the socket initialization.
Get the PeerSocket working

With this implementation state the PeerSocket is able to accept
datagrams asynchronously. It is working with 10 preallocated SAEA
objects that are reused and emits a new message event when new data
comes in.

NET-4
Moving code around and adapt the tests

There is a problem when async reading from the NIC. The SAEA object that
is used for async reading may be disposed while the socket is waiting
for incoming messages. The async method will throw an
ObjectDisposedException then. This is also causing the tests to fail.

Another issue is that on Mono there is no boxing possible for
PeerMessage as an EventHandler<T> argument. I don't know why, and I have
change the message to be a class while it's like that.

I did some benchmarks with a simple test app I wrote to benchmark the
library and it is showing pretty much no increase in CPU or memory usage
when data is sent with 100bytes every 10 miliseconds. For testing
purposes, I'm going to commit this test app and mak it mirror every
packet it gets.  I'm also trying to make it write benchmark data, so
everyone can see about performance.

NET-24, NET-4
Eventing

The PeerMessage class is now working with the Event model by deriving
from EventArgs. This would not be possible with a struct. Hence we have
to decide wether a class is fast enough and if a struct would have any
benefits in terms of speed and memory.

NET-24
Testadaption

The socket was never opened in the two tests.
Unreferencing event listeners

I read an article today that stated that event listeners never get freed
if you don't clean up after your class. So you will be probably carrying
a lot of garbage around if they are are not freed. And since this
library wants to make everyones life easier, we take care of this for
you.

The article I read was:

http://www.codeproject.com/Articles/639493/Events-Demystifying-Common-Memory-Leaks
Separating buffers

I introduced a scond queue of buffers dedicated to sending messages.
This doubles the buffersize allocated but makes sure that sending can't
fail due to no more SAEA objects in the _stateobjects pool.

Also the SAEA objects are now unregistering the complete methods.

The buffer size now is not only determined by the MTU but takes IP- and
UDP- headers into account.

NET-4
Setting socket options

There are some options that I wanted to try and here they are.
Refactoring of the PeerSocket class

The old implementation looked kind of messy to me and had some
experimentation code in it. So I redid this. Here is the code for
receiving messages, I'll implement sending in just a minute
Successful disposing

This was one of my hardest parts. When the socket was closed, the SAEA
objects returned with their Completed event and I just figured that out.
Now the event is supposed to reschedule a receiving object as fast as
possible and the previous attempts failed, because either the socket or
the objects for receiving had already been disposed.

With the current implementation that all works. There is no rescheduling
when the socket is disposed thanks to the _isReceiving flag.

NET-4