예제 #1
0
        static void StartReceive(Object obj)
        {
            TCPClientManager tcpClient = obj as TCPClientManager;

            byte[] recBytes = new byte[TCPPacket.RECV_MAX_SIZE];
            while (true)
            {
                try
                {
                    if (tcpClient._Socket == null)
                    {
                        continue;
                    }
                    int byteSize = tcpClient._Socket.Receive(recBytes, recBytes.Length, 0);
                    if (byteSize <= 0)
                    {
                        continue;
                    }
                    tcpClient._TCPPacket.WriteData(recBytes, 0, byteSize);
                }
                catch (Exception ex)
                {
                }
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: yanmf/chat
        static void Main()
        {
            tcpClient = new TCPClientManager("47.100.168.140", 4402);
            tcpClient.InitTcpClient();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Login());
        }