记录

@Ta 2022-04-08发布,2022-07-23修改 19204点击

https://www.intel.cn/content/www/cn/zh/support/articles/000005511/wireless.html

image.png

Windows 中遇到莫名奇妙的端口被占用解决

第一步:查找占用程序
netstat -aon|findstr "端口号"
返回内容中,可能存在两种情况:

有进程占用
无进程占用
如果有进程占用,最后一列是占用进程的ID,可以从任务管理器中找到对应ID的进程信息,或者直接结束进程:

taskkill /pid 程序PID -t -f
如果无进程占用,这个时候,很多人会很奇怪或不知所措,其实这种情况是存在的,其主要原因可能就是端口被应用程序设置为保留端口而无法使用,如Hyper-V保留。解决方法请看下一步。

第二步:通过第一步命令找不到被占用程序,可能是被系统保留
查看保留端口信息:

netsh interface ipv4 show excludedportrange protocol=tcp
检查被占用的端口是否在此列表范围中,如果是的话,如果是 Hyper-V 的原因的话:

停用Hyper-V
控制面板》程序》启用或关闭windows功能》去掉Hyper-V的勾选》确定并重启电脑

重启后,设置保留端口,以便Hyper-V不会将其占用
netsh int ipv4 add excludedportrange protocol=tcp startport=50070 numberofports=1

重新启用Hyper-V
控制面板》程序》启用或关闭windows功能》勾选Hyper-V》确定并重启电脑
————————————————
版权声明:本文为CSDN博主「long-king」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/long199366/article/details/111356619
一加8Pro

回复列表(12|隐藏机器人聊天)
  • @Ta / 2022-04-08 / /

    @老虎会游泳 AX211网卡 uos怎么驱动它。我看网上需要内核5.14版本
    一加8Pro

  • @Ta / 2022-07-23 / /
  • @Ta / 2022-11-11 / /
    apt-get -y update
    
    apt-get -y install \
        acl \
        apt-utils \
        attr \
        autoconf \
        bind9utils \
        binutils \
        bison \
        build-essential \
        ccache \
        chrpath \
        curl \
        debhelper \
        dnsutils \
        docbook-xml \
        docbook-xsl \
        flex \
        gcc \
        gdb \
        git \
        glusterfs-common \
        gzip \
        heimdal-multidev \
        hostname \
        htop \
        jq \
        krb5-config \
        krb5-kdc \
        krb5-user \
        lcov \
        libacl1-dev \
        libarchive-dev \
        libattr1-dev \
        libavahi-common-dev \
        libblkid-dev \
        libbsd-dev \
        libcap-dev \
        libcephfs-dev \
        libcups2-dev \
        libdbus-1-dev \
        libglib2.0-dev \
        libgnutls28-dev \
        libgpgme-dev \
        libicu-dev \
        libjansson-dev \
        libjs-jquery \
        libjson-perl \
        libkrb5-dev \
        libldap2-dev \
        liblmdb-dev \
        libncurses5-dev \
        libpam0g-dev \
        libparse-yapp-perl \
        libpcap-dev \
        libpopt-dev \
        libreadline-dev \
        libsystemd-dev \
        libtasn1-bin \
        libtasn1-6-dev \
        libtracker-sparql-2.0-dev \
        libunwind-dev \
        lmdb-utils \
        locales \
        lsb-release \
        make \
        mawk \
        mingw-w64 \
        patch \
        perl \
        perl-modules-5.28 \
        pkg-config \
        procps \
        psmisc \
        python3 \
        python3-cryptography \
        python3-dbg \
        python3-dev \
        python3-dnspython \
        python3-gpg \
        python3-iso8601 \
        python3-markdown \
        python3-pexpect \
        python3-pyasn1 \
        python3-requests \
        python3-setproctitle \
        rng-tools \
        rsync \
        sed \
        sudo \
        tar \
        tree \
        uuid-dev \
        wget \
        xfslibs-dev \
        xsltproc \
        xz-utils \
        zlib1g-dev
    
  • @Ta / 2022-11-27 / /

    录屏_选择区域_20221127223721.gif
    一加8Pro

  • @Ta / 2022-12-10 / /
  • @Ta / 2023-02-20 / /
    // 聊天框的CSS选择器
    const chatBoxSelector = 'textarea.w-full.p-0';
    
    // 发送按钮的CSS选择器
    const sendButtonSelector = 'button.absolute.p-1';
    
    // 正在输入动效(取代发送按钮)的CSS选择器
    const replyNotReadySelector = 'div.text-2xl';
    
    // 聊天回答的CSS选择器
    const chatReplySelector = 'div.markdown';
    
    // 用户自身的虎绿林uid
    const hu60MyUid = 19346; // 改成自己的uid
    
    // 用户的虎绿林sid
    const hu60Sid = '4JfOlTT3iHw58i1ITtpS0okksAAA';
    
    // 带sid的虎绿林URL
    const hu60BaseUrl = 'https://hu60.cn/q.php/' + hu60Sid + '/';
    
    /////////////////////////////////////////////////////////////
    
    // 发送聊天信息
    function sendText(text) {
        let chatBox = document.querySelector(chatBoxSelector);
        let sendButton = document.querySelector(sendButtonSelector);
    
        chatBox.value = text;
        sendButton.click();
    }
    
    // 读取响应
    function readReply() {
        let reply = Array.from(document.querySelectorAll(chatReplySelector)).at(-1);
        let lines = [];
        
        if (!reply.childNodes) {
            // 错误信息
            return reply.innerText;
        }
    
        reply.childNodes.forEach(x => {
            if (x.tagName == 'PRE') { // 代码
                lines.push("\n```\n" + x.querySelector('code').innerText + "\n```\n");
            } else { // 正文
                lines.push(x.innerText);
            }
        });
    
        return lines.join("\n\n");
    }
    
    // 判断响应是否结束
    function isFinished() {
        return document.querySelector(replyNotReadySelector) == null;
    }
    
    // 读取@消息
    async function readAtInfo() {
        let response = await fetch(hu60BaseUrl + 'msg.index.@.no.json?_origin=*&_content=json');
        return await response.json();
    }
    
    // 读取帖子内容
    async function readTopicContent(path) {
        let url = hu60BaseUrl + path.replace('{$BID}', 'json').replace('?', '?_origin=*&_content=text&pageSize=1&');
        let response = await fetch(url);
        return await response.json();
    }
    
    // 回复帖子
    async function replyTopic(uid, replyText, topicObject) {
        let content = "<!md>\n@#" + uid + "," + replyText;
    
        let url = null;
        if (topicObject.tMeta) { // 帖子
            url = 'bbs.newreply.'+encodeURIComponent(topicObject.tContents[0].topic_id)+'.json';
        } else { // 聊天室
            url = 'addin.chat.'+encodeURIComponent(topicObject.chatRomName)+'.json';
        }
    
        let formData = new FormData();
        formData.append('content', content);
        formData.append('token', topicObject.token);
        formData.append('go', '1');
    
        let response = await fetch(hu60BaseUrl + url + '?_origin=*', {
            body: formData,
            method: "post",
            redirect: "manual" // 不自动重定向
        });
        return response;
    }
    
    // 休眠指定的毫秒数
    // 用法:await sleep(1000)
    const sleep = ms => new Promise(r => setTimeout(r, ms));
    
    // 回复@信息
    async function replyAtInfo(info) {
        try {
            let uid = info.byuid;
            let url = info.content[0].url;
            let floor = url.split('#')[1];
    
            // 防止自己和自己对话
            if (uid == hu60MyUid || uid < 1) {
                return;
            }
    
            console.log(info);
    
            let topicObject = await readTopicContent(url);
            let text = null;
            if (topicObject.tContents) {
                text = topicObject.tContents[0].content;
            } else {
                text = topicObject.chatList[0].content;
            }
            
            sendText(text);
    
            do {
                await sleep(500);
            } while (!isFinished());
    
            let replyText = readReply();
            let response = await replyTopic(uid, replyText, topicObject);
            console.log(response);
        } catch (ex) {
            console.error(ex);
        }
    }
    
    // 运行机器人
    async function run() {
        console.log('虎绿林ChatGPT机器人已启动');
        while (true) {
            try {
                // 浏览器用户可能直接输入了问题,等待回答完成
                if (!isFinished()) {
                    do {
                        await sleep(500);
                    } while (!isFinished());
                }
    
                let atInfo = await readAtInfo();
                console.log(new Date(), atInfo);
                for (let i=0; i<atInfo.msgList.length; i++) {
                    await replyAtInfo(atInfo.msgList[i]);
                }
                await sleep(1000);
            } catch (ex) {
                console.error(ex);
            }
        }
    }
    
    run();
    

    一加8Pro

添加新回复
回复需要登录