示例#1
0
        // 登录指定房间
        private bool LoginRoom(int roomID)
        {
            bool result = false;

            try
            {
                socket.Send(DouyuClientPackageBuilder.GetLoginRequestPackage(roomID));
                byte[] response = new byte[BUFFER_SIZE];
                socket.Receive(response);
                if (ParseLoginResponse(response))
                {
                    result = true;
                    logger.Log("登录直播间...成功");
                }
                else
                {
                    logger.Log("登录直播间...失败");
                }
            }
            catch (Exception e)
            {
                logger.Log("登录直播间...失败");
                logger.Log(e.Message);
            }
            return(result);
        }
示例#2
0
 // 心跳连接
 public void KeepAlive()
 {
     try
     {
         socket.Send(DouyuClientPackageBuilder.GetKeepAlivePackage());
     }
     catch (Exception e)
     {
         logger.Log("发送心跳包...失败");
         logger.Log(e.Message);
     }
 }
示例#3
0
        // 加入弹幕分组池
        private bool JoinGroup(int roomID, int groupID)
        {
            bool result = false;

            try
            {
                socket.Send(DouyuClientPackageBuilder.GetJoinGroupRequestPackage(roomID, groupID));
                result = true;
                logger.Log("加入弹幕分组池...成功");
            }
            catch (Exception e)
            {
                logger.Log("加入弹幕分组池...失败");
                logger.Log(e.Message);
            }
            return(result);
        }