public void TestHandler(UdpContext udpContext) { hello = udpContext.GetData <Hello>(); if (hello.HelloString == "re") { UdpServerTest.ackNums++; } }
public void OnReceiveData(UdpContext udpContext) { IntegrationTest.data[peer.ID] = udpContext.GetData <string>(); if (IntegrationTest.data[peer.ID] is "test") { Interlocked.Increment(ref IntegrationTest.nums); } }
public void OnReceiveData(UdpContext udpContext) { var d = udpContext.GetData <string>(); if (d == "test") { Program.nums++; } Console.WriteLine("peer:" + d); }
public static DataSlice FromBytes(Memory <byte> bytes, UdpContext context) { var slice = new DataSlice(); var span = bytes.Span; slice.Last = MemoryMarshal.Read <bool>(span.Slice(0, 1)); slice.Len = MemoryMarshal.Read <int>(span.Slice(1, 4)); slice.No = MemoryMarshal.Read <long>(span.Slice(5, 8)); slice.SessionId = MemoryMarshal.Read <Guid>(span.Slice(13, 16)); slice.Slice = bytes[29..];
public async void StreamHandShakeHandler(UdpContext context) { await peer.StreamTransferRequested(context.GetData <BasicFileInfo>()); }
public void StreamHandShakeCallbackHandler(UdpContext context) { peer.OnStreamHandshakeResult(context); }
public void StartPunchingHandler(UdpContext context) { peer.StartHolePunching(); _logger.LogInformation("punching started"); context.Dispose(); }
public void PunchingDataHandler(UdpContext context) { _logger.LogInformation($"peer {peer.OuterEp?.ToIPEP()} punch data received"); peer.PunchDataReceived(context.RemoteEndPoint); context.Dispose(); }
public void MTUHandler(UdpContext udpContext) { peer.RemoteBufferLen = udpContext.GetData <int>(); }
public void PingHandeler(UdpContext context) { peer.ResetPingCount(); context.Dispose(); }
public async void FileDataHandler(UdpContext context) { await peer.FileDataReceived(DataSlice.FromBytes(context.Data, context)); }
public async void ConnectionRequestedHandler(UdpContext context) { _logger.LogInformation("received connection request!"); await peer.OnConnectionRequested(context.GetData <PeerInfo>() !); }
public void ConnectionRequestCallbackHandler(UdpContext context) { peer.OnConnectionCallback(context.GetData <bool>()); _logger.LogInformation("received connection request callback!"); }
public void ConnectedDataHandler(UdpContext context) { _logger.LogInformation($"peer {peer.OuterEp?.ToIPEP()} connect data received"); peer.PeerConnectedReceived(); context.Dispose(); }
public void ChatMsgHandler(UdpContext udpContext) { OnChatMsgReceived?.Invoke(this, udpContext.GetData <string>()); }