private void Completed(object sender, SocketAsyncEventArgs socketAsyncEventArgs) { if (IsStop) return; using (socketAsyncEventArgs) { try { using (var stream = new MemoryStream(socketAsyncEventArgs.Buffer, 0, socketAsyncEventArgs.BytesTransferred)) using (var streamReader = new StreamReader(stream)) { var senderId = streamReader.ReadLine(); var clusterManagerUrl = streamReader.ReadLine(); var clientDiscovered = new ClientDiscoveredEventArgs { ClusterManagerUrl = clusterManagerUrl, }; Guid result; if (Guid.TryParse(senderId, out result)) { clientDiscovered.SenderId = result; InvokeClientDiscovered(clientDiscovered); } } } catch { } StartListening(); } }
private void Completed(object sender, SocketAsyncEventArgs socketAsyncEventArgs) { if (IsStop) { return; } using (socketAsyncEventArgs) { try { using (var stream = new MemoryStream(socketAsyncEventArgs.Buffer, 0, socketAsyncEventArgs.BytesTransferred)) using (var streamReader = new StreamReader(stream)) { var senderId = streamReader.ReadLine(); var clusterManagerUrl = streamReader.ReadLine(); var clientDiscovered = new ClientDiscoveredEventArgs { ClusterManagerUrl = clusterManagerUrl, }; Guid result; if (Guid.TryParse(senderId, out result)) { clientDiscovered.SenderId = result; InvokeClientDiscovered(clientDiscovered); } } } catch { } StartListening(); } }
private void InvokeClientDiscovered(ClientDiscoveredEventArgs e) { EventHandler <ClientDiscoveredEventArgs> handler = ClientDiscovered; if (handler != null) { handler(this, e); } }
private void Completed(object sender, SocketAsyncEventArgs socketAsyncEventArgs) { using (socketAsyncEventArgs) { try { using (var stream = new MemoryStream(socketAsyncEventArgs.Buffer, 0, socketAsyncEventArgs.BytesTransferred)) using (var streamReader = new StreamReader(stream)) { var senderId = streamReader.ReadLine(); var userId = streamReader.ReadLine(); var clientDiscovered = new ClientDiscoveredEventArgs { MachineName = streamReader.ReadLine(), UserName = streamReader.ReadLine() }; Guid result; if (Guid.TryParse(userId, out result)) { clientDiscovered.UserId = result; } if (Guid.TryParse(senderId, out result)) { clientDiscovered.SenderId = result; InvokeClientDiscovered(clientDiscovered); } } } catch { } StartListening(); } }
private void Completed(object sender, SocketAsyncEventArgs socketAsyncEventArgs) { using (socketAsyncEventArgs) { try { using (var stream = new MemoryStream(socketAsyncEventArgs.Buffer, 0, socketAsyncEventArgs.BytesTransferred)) using (var streamReader = new StreamReader(stream)) { var senderId = streamReader.ReadLine(); var userId = streamReader.ReadLine(); var clientDiscovered = new ClientDiscoveredEventArgs { MachineName = streamReader.ReadLine(), UserName = streamReader.ReadLine() }; Guid result; if (Guid.TryParse(userId, out result)) { clientDiscovered.UserId = result; } if (Guid.TryParse(senderId, out result)) { clientDiscovered.SenderId = result; InvokeClientDiscovered(clientDiscovered); } } } catch { } StartListening(); } }
private void InvokeClientDiscovered(ClientDiscoveredEventArgs e) { EventHandler<ClientDiscoveredEventArgs> handler = ClientDiscovered; if (handler != null) handler(this, e); }