public void Open()
{
lock(_lock)
{
_requireState(State.Closed);
// make sure that everything is cleaned up
// from previous times the port was open, should be nop
_disposeAll();
try
{
_createBbmdMac();
// creates the UDP server
_createServer();
// start foreign device registration
_state = State.Registering;
_startRegistering();
}
catch
{
// clean up anything that has been created
_disposeAll();
_state = State.Closed;
throw;
}
}
}