try
{
- _listenTask = ListenAsync();
+ _listenTask = Task.Factory.StartNew(ListenAsync, TaskCreationOptions.LongRunning);
}
catch (ObjectDisposedException)
{
public Task StartAsync()
{
// Store the task we're executing
- _executingTask = ReadAsync();
+ _executingTask = Task.Factory.StartNew(ReadAsync, TaskCreationOptions.LongRunning);
// If the task is completed then return it, this will bubble cancellation and failure to the caller
if (_executingTask.IsCompleted)
public override Task StartAsync()
{
// Store the task we're executing
- _executingTask = ListenAsync();
+ _executingTask = Task.Factory.StartNew(ListenAsync, TaskCreationOptions.LongRunning);
// If the task is completed then return it, this will bubble cancellation and failure to the caller
if (_executingTask.IsCompleted)
var addressLength = reader.ReadByte();
var addressBytes = reader.ReadBytes(addressLength);
var addressPort = reader.ReadUInt16();
- var address = new IPEndPoint(new IPAddress(addressBytes), clientId);
+ var address = new IPEndPoint(new IPAddress(addressBytes), addressPort);
var name = reader.ReadString();
// Create and register connection.