void ServerOnInputConnected(DeliveryConnection conn) { string RemoteEndPoint = null; try { RemoteEndPoint = conn.socket?.RemoteEndPoint.ToString(); client.Connect((conn2) => { conn.Bind(conn2); Logger.Info("转发成功[" + RemoteEndPoint + "]"); }); } catch (Exception ex) { Logger.Error("转发失败[" + RemoteEndPoint + "]", ex); } }
void Output_OnReceiveStartMsg(DeliveryConnection output, ArraySegment <byte> data) { StartNewOutput(); localClient.Connect((local) => { try { if (data.Count != 0) { local.SendFrameAsync(data); } } catch (Exception ex) { Logger.Error(ex); } local.Bind(output); }); }
void StartNewOutput() { outputClient.Connect(Output_OnConnected); }