Пример #1
0
        private NicoClient(NicoServerInfo serverInfo, NicoThread threadData)
        {
            var packetEnDecoder = new NicoPacketEnDecoder();

            client.Encoder = packetEnDecoder;
            client.Decoder = packetEnDecoder;

            client.OnSocketException += (s, e) => Console.WriteLine(e.Exception.Message);
            client.OnDisconnect      += (s, e) => Console.WriteLine("Disconnected.");

            client.OnConnected += (s, e) =>
            {
                Console.WriteLine("Connected");
                e.Send(threadData);
            };

            client.OnDataReceived += client_OnDataReceived;
            client.Connect(new DnsEndPoint(serverInfo.Address, serverInfo.Port));
        }
Пример #2
0
 public static NicoClient Connect(NicoServerInfo info, NicoThread thread)
 {
     return(new NicoClient(info, thread));
 }