public static void Example3() { Thread.Sleep(2000); var client = new UNetClient(new StandardPacketProcessor()); client.RegisterOperation <FileTransferOperation>(); client.Connect("127.0.0.1", 1000); Console.ReadLine(); }
public static void Example5() { var client = new UNetClient(new StandardPacketProcessor()); Thread.Sleep(2000); client.Connect("127.0.0.1", 1000); client.OnPacketReceived += (o, e) => { Console.WriteLine(e.Packet); }; }
public static void Example2() { Thread.Sleep(2000); var client = new UNetClient(new StandardPacketProcessor()); client.EnsurePacketIntegrity = true; client.PacketIntegrityHash = Security.PacketIntegrityHash.Sha256; client.Connect("127.0.0.1", 1000); Console.ReadLine(); }
public TcpClientChannel(UNetClient client, Dictionary <Guid, List <ISequencePacket> > activeSequenceSessions) { ChannelSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _synchronizeHandle = new AutoResetEvent(false); _buffObj = new BufferObject(_bufferSize = 8192); Client = client; _activeSequenceSessions = activeSequenceSessions; _netWriter = new NetworkWriter(); ActiveSocketOperations = new Dictionary <Guid, ISocketOperation>(); OperationTable = new Dictionary <int, Type>(); _lockObj = new object(); }
public static void Example4() { Thread.Sleep(2000); var client = new UNetClient(new StandardPacketProcessor()); client.OnPacketReceived += (sender, e) => { if (e.Packet.PacketId == 1) { Console.WriteLine("Received pingpacket to client @ channel {0}", e.Channel.Id); client.Send(new PingPacket(), e.Channel); } }; client.Connect("127.0.0.1", 1000); Console.ReadLine(); }
public ClientEventArgs(UNetClient client, IChannel channel) { Client = client; Channel = channel; }