Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从长轮询更改为PHP WebSockets/常规套接字?_Php_Android_Sockets_Phpwebsocket_Chatroom - Fatal编程技术网

从长轮询更改为PHP WebSockets/常规套接字?

从长轮询更改为PHP WebSockets/常规套接字?,php,android,sockets,phpwebsocket,chatroom,Php,Android,Sockets,Phpwebsocket,Chatroom,在我最终总结了一些关于不同问题的东西之后,我想我应该把注意力转移到我以前的一个项目上,我想进行升级 我有一个PHP聊天室,我被告知它使用长轮询在我的网站(由WAMP服务器托管)上的用户之间发送和接收消息。告诉我这是一项长期调查的同一个人建议我使用Web套接字。我发现PHPWebSockets只与支持HTML5的浏览器兼容,尽管最近另一位朋友向我指出,这些浏览器之间的兼容性非常低 无论如何,在这一点上,我想建立一个Android应用程序,将连接到这个聊天室。我应该使用PHP WebSocket吗?

在我最终总结了一些关于不同问题的东西之后,我想我应该把注意力转移到我以前的一个项目上,我想进行升级

我有一个PHP聊天室,我被告知它使用长轮询在我的网站(由WAMP服务器托管)上的用户之间发送和接收消息。告诉我这是一项长期调查的同一个人建议我使用Web套接字。我发现PHPWebSockets只与支持HTML5的浏览器兼容,尽管最近另一位朋友向我指出,这些浏览器之间的兼容性非常低

无论如何,在这一点上,我想建立一个Android应用程序,将连接到这个聊天室。我应该使用PHP WebSocket吗?还是普通插座

最后,我需要做些什么才能使这项改革成为当前的代码,我必须把我的聊天室变成一个更加基于套接字的工作

这是我的档案

post.php:

<?php
session_start();
if(isset($_SESSION['user'])){
    $text = $_POST['text'];
    #chmod("log.html", 0777);
    $fp = fopen("log.html", 'a') or die("Unable to open/write file!");

    fwrite($fp, "<div class='msgln'>(".date("g:i A").") <b>".$_SESSION['user']."</b>: ". formatTextLinksVerbose(stripslashes(htmlspecialchars($text))) ."<br></div>");
    fclose($fp);
    echo "Just wrote the file";
}

function formatTextLinks($text) {
    $words = preg_split("/[\s,\?!]+/", $text);
    $offset = 0;

    foreach($words as $value) {
        preg_match("/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/", $value, $matches);

        $s = $matches[0];
        if(!is_string($s)) continue;
        $pos = strpos($text, $s, $offset);
        if($pos !== false) {
            $helper = "";
            if(strpos($s, "http://") === false || strpos($s, "https://") === false) $helper = "http://";
            if(strpos($s, "http://") !== false) $helper = "";
            if(strpos($s, "https://") !== false) $helper = "";

            $text = substr_replace($text, "<a href='".$helper.rtrim($s, '.')."' target='_blank'>".$s."</a>", $pos, strlen($s));
            $offset = $pos + strlen("<a href='".$helper.rtrim($s, '.')."' target='_blank'>".$s."</a>");
        }
    }

    return $text;
}

function formatTextLinks2($text) {
    $words = preg_split("/[\s,\?!]+/", $text);
    $offset = 0;

    foreach($words as $value) {
        preg_match('/^(http|https|ftp)://([A-Z0-9][A-Z0-9_-]*(?:.[A-Z0-9][A-Z0-9_-]*)+):?(d+)?/?/i', $value, $matches);

        $s = $matches[0];
        if(!is_string($s)) continue;
        $pos = strpos($text, $s, $offset);
        if($pos !== false) {
            $helper = "";
            if(strpos($s, "http://") === false || strpos($s, "https://") === false) $helper = "http://";
            if(strpos($s, "http://") !== false) $helper = "";
            if(strpos($s, "https://") !== false) $helper = "";

            $text = substr_replace($text, "<a href='".$helper.$s."' target='_blank'>".$s."</a>", $pos, strlen($s));
            $offset = $pos + strlen("<a href='".$helper.$s."' target='_blank'>".$s."</a>");
        }
    }

    return $text;
}

function formatTextLinksVerbose($text) {
    $rexProtocol = '(https?://)?';
    $rexDomain   = '((?:[-a-zA-Z0-9]{1,63}\.)+[-a-zA-Z0-9]{2,63}|(?:[0-9]{1,3}\.){3}[0-9]{1,3})';
    $rexPort     = '(:[0-9]{1,5})?';
    $rexPath     = '(/[!$-/0-9:;=@_\':;!a-zA-Z\x7f-\xff]*)?';
    $rexQuery    = '(\?[!$-/0-9:;=@_\':;!a-zA-Z\x7f-\xff]+)?';
    $rexFragment = '(#[!$-/0-9:;=@_\':;!a-zA-Z\x7f-\xff]+)?';

    $emailPattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';

    $validTlds = array_fill_keys(explode(" ", ".aero .asia .biz .cat .com .coop .edu .gov .info .int .jobs .mil .mobi .museum .name .net .org .pro .tel .travel .ac .ad .ae .af .ag .ai .al .am .an .ao .aq .ar .as .at .au .aw .ax .az .ba .bb .bd .be .bf .bg .bh .bi .bj .bm .bn .bo .br .bs .bt .bv .bw .by .bz .ca .cc .cd .cf .cg .ch .ci .ck .cl .cm .cn .co .cr .cu .cv .cx .cy .cz .de .dj .dk .dm .do .dz .ec .ee .eg .er .es .et .eu .fi .fj .fk .fm .fo .fr .ga .gb .gd .ge .gf .gg .gh .gi .gl .gm .gn .gp .gq .gr .gs .gt .gu .gw .gy .hk .hm .hn .hr .ht .hu .id .ie .il .im .in .io .iq .ir .is .it .je .jm .jo .jp .ke .kg .kh .ki .km .kn .kp .kr .kw .ky .kz .la .lb .lc .li .lk .lr .ls .lt .lu .lv .ly .ma .mc .md .me .mg .mh .mk .ml .mm .mn .mo .mp .mq .mr .ms .mt .mu .mv .mw .mx .my .mz .na .nc .ne .nf .ng .ni .nl .no .np .nr .nu .nz .om .pa .pe .pf .pg .ph .pk .pl .pm .pn .pr .ps .pt .pw .py .qa .re .ro .rs .ru .rw .sa .sb .sc .sd .se .sg .sh .si .sj .sk .sl .sm .sn .so .sr .st .su .sv .sy .sz .tc .td .tf .tg .th .tj .tk .tl .tm .tn .to .today .tp .tr .tt .tv .tw .tz .ua .ug .uk .us .uy .uz .va .vc .ve .vg .vi .vn .vu .wf .ws .ye .yt .yu .za .zm .zw .xn--0zwm56d .xn--11b5bs3a9aj6g .xn--80akhbyknj4f .xn--9t4b11yi5a .xn--deba0ad .xn--g6w251d .xn--hgbk6aj7f53bba .xn--hlcj6aya9esc7a .xn--jxalpdlp .xn--kgbechtv .xn--zckzah .arpa"), true);
    $validImgs = array_fill_keys(explode(" ", ".jpg .bmp . png .gif .tiff .jfif .jpeg .tif .ppm .pgm .pbm .pnm .img .svg"), true);

    $position = 0;
    $returnText = "";
    $extraHelper;
    $emailReplacement = "";
    $URLfound = false;
    $emailFound = false;

    while (preg_match("{\\b$rexProtocol$rexDomain$rexPort$rexPath$rexQuery$rexFragment(?=[?.!,;:\"\'-]?(.|$))}", $text, $match, PREG_OFFSET_CAPTURE, $position))
    {
        //reset our extra helper text variable and emailFound boolean
        $extraHelper = "";
        $emailFound = false;

        list($url, $urlPosition) = $match[0];

        //Debug statement
        //$returnText .= "Well we definitely got a preg_match here. ";

        $wehaveEmail = strpos( "{\s.+@}", substr($text, $position, $urlPosition - $position));
        if($wehaveEmail !== false) {
            echo "We have detected a worthy email! " . substr($text, $wehaveEmail, $urlPosition - $wehaveEmail);
            $falsePositive = strpos( "{\s[\.]+@}", substr($text, $position, $urlPosition - $position));
            if( preg_match( "{\s\.+.*@}", substr($text, $wehaveEmail, $urlPosition - $position), $falseMatches, PREG_OFFSET_CAPTURE)) {
                echo "Uh, never mind. " . $falseMatches[0][0];
            }
        }

        if(preg_match( "/(?<!\S)\w+(?:[.-]\w+)*@/", substr($text, $position, $urlPosition - $position), $eMatches, PREG_OFFSET_CAPTURE))
        {
            //$returnText .= "Whoa, we got an email here!";
            //echo "Our position values are: " . $urlPosition . " " . $position . " and also our first result can be found at: " . strpos(substr($text, $urlPosition - $position, $urlPosition - $position), "{^[\w]@$}");
            echo "Also we have a match at: " . $eMatches[0][0];
            //echo "If we used preg_replace: " . preg_replace("{\b\w*@(?:[-a-zA-Z0-9]{1,63}\.)+[-a-zA-Z0-9]{2,63}\b}", "<a href ='mailto:" . $eMatches[0][0] . $match[2][0] . "'> " . $eMatches[0][0] . $match[2][0] . "</a>", (substr($text, $position, $urlPosition - $position)) . $match[2][0]);
            $emailReplacement = preg_replace("{\s\S+\@(?:[-a-zA-Z0-9]{1,63}\.)+[-a-zA-Z0-9]{2,63}\b}", "<a href='mailto:" . $eMatches[0][0] . $match[2][0] . "'> " . $eMatches[0][0] . $match[2][0] . "</a>", (substr($text, $position, $urlPosition - $position)) . $match[2][0]);
            $emailFound = true;
        }

        else {
        // Append the text leading up to the URL in return value.
        $returnText .= /*"Leading up to URL: " .*/ htmlspecialchars(substr($text, $position, $urlPosition - $position));

        }

        $domain = $match[2][0];
        $port   = $match[3][0];
        $path   = $match[4][0];
        $query  = $match[5][0];
        $fragment = $match[6][0];

        echo "Domain is: " . $domain . " and path is: " . $path . " and query is: " . $query;

        //if the domain variable was captured with extra hyphens
        if(preg_match("{.*-+}", $domain))
        {
            //add to our helper variable
            $extraHelper = $domain;
            $domain = rtrim($domain, "-");
            $extraHelper = substr($extraHelper, strlen($domain));
        }

        //Debug statement
        //$returnText .= "Domain is: " . $domain . " $match[0] is: " . print_r($match[0]);



        // Check if the TLD is valid - or that $domain is an IP address.
        $tld = strtolower(strrchr($domain, '.'));
        if ( preg_match('{\.[0-9]{1,3}}', $tld) || isset($validTlds[$tld]) )
        {
            if($emailFound) {

                //$completeUrl = $emailReplacement;

                echo "Our email replacement string: " . $emailReplacement;

                // Append email hyperlink.
                $returnText .= $emailReplacement . $extraHelper;

            }


            else {
                $img = strtolower(strrchr($path, '.'));
                if(!$emailFound && isset($validImgs[$img]))
                {
                    echo "We found an image!";
                    // Prepend http:// if no protocol specified
                    $completeUrl = $match[1][0] ? $url : "http://$url";

                    // Append the hyperlink.
                    $returnText .= '<a href="' . htmlspecialchars($completeUrl) . '" target="_blank"><img src="' . htmlspecialchars($completeUrl) . '"></a>' . $extraHelper;
                }

                else
                {
                    // Prepend http:// if no protocol specified
                    $completeUrl = $match[1][0] ? $url : "http://$url";

                    // Append the hyperlink.
                    $returnText .= '<a href="' . htmlspecialchars($completeUrl) . '" target="_blank">' . htmlspecialchars("$domain$port$path$query$fragment") . '</a>' . $extraHelper;
                }
            }
        }
        else
        {
            //NOTE: this search function is under construction, it would filter a URL despite trailing alphanumeric characters.
            /*
            //if ANY value from $validTlds[] are INSIDE the $tld string at all
            foreach($validTlds as $needle) {
                $matchTLDindex = strpos($tld, $needle, 0);
                echo "Current needle is " . strval($needle);

                if($matchTLDindex !== false)
                {
                    //make sure the matches are exactly from the beginning of the compared variables
                    if(strcmp($validTlds[$matchTLDindex], substr($tld, strlen($validTlds[$matchTLDindex])) !== false))
                    {
                        $returnText .= "So our valid TLD match is " . strlen($validTlds[$matchTLDindex]) . " and our substring compared was: " . substr($tld, strlen($validTlds[$matchTLDindex])) . " and our index is " . strval($matchTLDindex) . " Just for kicks, one of the first tested TLDs was: " . $validTlds[1];
                        // Append our trailing helper string
                        $extraHelper .= substr($tld, strlen($validTlds[$matchTLDindex]));
                        $tld = $validTlds[$matchTLDindex];
                        //$extraHelper = substr($extraHelper, strlen($tld), strlen($extraHelper));

                        $returnText .= "Currently extraHelper is: " . $extraHelper . " and $tld is " . $tld;
                        // Prepend http:// if no protocol specified
                        $completeUrl = $match[1][0] ? $url : "http://$url";

                        // Append the hyperlink.
                        $returnText .= '<a href="' . htmlspecialchars($completeUrl) . '" target = "_blank">' . htmlspecialchars("$domain$port$path") . '</a>' . $extraHelper;

                        //we found and appended our URL, mark the flag
                        $URLfound = true;

                        //break out of foreach loop, job done
                        break;
                    }
                }
            }
            */
            if($URLfound == false && !$emailFound) {
                // Not a valid URL.
                $returnText .= htmlspecialchars($url);
            }
        }

        // Continue text parsing from after the URL.
        $position = $urlPosition + strlen($url);
    }

    // Append and return the remainder of the text.
    return($returnText . htmlspecialchars_decode((htmlspecialchars(substr($text, $position))), ENT_COMPAT));
}

function formatEmails($text) {
    $words = preg_split("/[\s,\?!]+/", $text);
    $offset = 0;

    foreach($words as $value) {
        preg_match("/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/", $value, $matches);

        $s = $matches[0];
        if(!is_string($s)) continue;
        $pos = strpos($text, $s, $offset);
        if($pos !== false) {
            /*$helper = "";
            if(strpos($s, "http://") === false || strpos($s, "https://") === false) $helper = "http://";
            if(strpos($s, "http://") !== false) $helper = "";
            if(strpos($s, "https://") !== false) $helper = "";*/

            $text = substr_replace($text, "<a href='mailto:".rtrim($s, '.')."' target='_top'>".$s."</a>", $pos, strlen($s));
            $offset = $pos + strlen("<a href='".$helper.$s."' target='_top'>".$s."</a>");
        }
    }

    return $text;
}
?>

chatroom.php:

<?php session_start();
#session_regenerate_id(true);
include ("dbconfig.php");
if(!isset($_SESSION['introd']))
{   
    header("Location: intro.php");
}
if(!isset($_SESSION['user']))
{   
    header("Location: index.php");
}
 ?>
<!DOCTYPE html>
 <html>
<head>
    <title>My Webpage</title>
<!--    <meta name = "viewport" content = "width=device-width, initial-scale=1.0"/>-->
    <link rel = "stylesheet" type = "text/css" href = "site.css" />
    <link rel="shortcut icon" href="/favicon.gif" type="image/gif" />
    <script>




        </script>
</head>

<body>
    <?php include("header.php"); ?>

                <div id="wrapper">
                    <div id="menu">
                        <p class="welcome">Welcome, <b><?php echo $_SESSION['user']; ?></b></p>
                        <div style="clear:both"></div>
                    </div>

                    <div id="chatbox"><?php
                    if(file_exists("log.html") && filesize("log.html") > 0){
                        $handle = fopen("log.html", "r");
                        $contents = fread($handle, filesize("log.html"));
                        fclose($handle);

                        echo $contents;
                    }
                    ?></div>

                    <form name="message" action="">
                        <input name="usermsg" type="text" id="usermsg" size="63" />
                        <input name="submitmsg" type="submit"  id="submitmsg" value="Send" />
                    </form>
                    <div id="sound"></div>
                </div>
                <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
                <script type="text/javascript">
                // jQuery Document
                $(document).ready(function(){

                    var original = document.title;
                    var timeout;

                    window.flashTitle = function (newMsg, howManyTimes) {
                        function step() {
                            document.title = (document.title == original) ? newMsg : original;

                            if (--howManyTimes > 0) {
                                timeout = setTimeout(step, 1000);
                            };
                        };

                        howManyTimes = parseInt(howManyTimes);

                        if (isNaN(howManyTimes)) {
                            howManyTimes = 5;
                        };

                        cancelFlashTitle(timeout);
                        step();
                    };

                    window.cancelFlashTitle = function () {
                        clearTimeout(timeout);
                        document.title = original;
                    };

                    setInterval (loadLog, 2000);    //Reload file every 2500 ms or x ms if you wish to change the second parameter

                    //If user submits the form
                    $("#submitmsg").click(function(event){

                        var clientmsg = $("#usermsg").val();
                        $.post("post.php", {text:clientmsg});
                        //alert("About to post");
                        //event.preventDefault();
                        /*$.ajax({
                            type: "POST",
                            url: "post.php",
                            data: {text:clientmsg},
                            //dataType: text,
                            error: function(){
                                alert("Error receiving text: " + response);
                            },
                            success: function(response){
                                alert("Submission received: " + response);
                            },
                        });*/
                        $("#usermsg").attr("value", "");
                        return false;
                    });

                    function notifyNewMessage(){

                    }



                    //Load the file containing the chat log
                    function loadLog(){     
                        var oldscrollHeight = $("#chatbox").attr("scrollHeight") - 20; //Scroll height before the request
                        $.ajax({
                            url: "log.html",
                            cache: false,
                            success: function(html){
                                if((html.length - $("#chatbox").html().length) != 0) {
                                    //alert("The new message is: " + html + " /n and chatbox has: " + $("#chatbox").html());
                                    $("#chatbox").html(html); //Insert chat log into the #chatbox div
                                    var soundCheck = <?php echo $_SESSION['sound']; ?>;
                                    //alert(soundCheck);
                                    if(soundCheck == 1){
                                        document.getElementById("sound").innerHTML='<audio autoplay="autoplay"><source src="SCR_WR.mp3" type="audio/mp3" />';
                                    }
                                    flashTitle("New Message!", 6);
                                    //document.title = "My Webpage";
                                }


                                //Auto-scroll           
                                var newscrollHeight = $("#chatbox").attr("scrollHeight") - 20; //Scroll height after the request
                                if(newscrollHeight > oldscrollHeight){
                                    $("#chatbox").animate({ scrollTop: newscrollHeight }, 'normal'); //Autoscroll to bottom of div
                                }               
                            },
                        });
                    }
                });
                </script>

                <center><a href='logout.php'>Logout</a></center>    

            <p class = "content"> This is a page that is a scrap work in progress. </p>


            <?php include("footer.php"); ?> 
    </body>
</html>

我的网页

欢迎

//jQuery文档 $(文档).ready(函数(){ var original=document.title; var超时; window.flashTitle=函数(newMsg,howManyTimes){ 函数步骤(){ document.title=(document.title==原件)?newMsg:原件; 如果(--howManyTimes>0){ 超时=设置超时(步骤1000); }; }; howManyTimes=parseInt(howManyTimes); 如果(isNaN(多少次)){ 多少次=5; }; 取消FlashTitle(超时); 步骤(); }; window.cancelFlashTitle=函数(){ clearTimeout(超时); document.title=原件; }; setInterval(loadLog,2000);//如果要更改第二个参数,请每隔2500毫秒或x毫秒重新加载文件 //如果用户提交表单 $(“#submitmsg”)。单击(函数(事件){ var clientmsg=$(“#usermsg”).val(); $.post(“post.php”,{text:clientmsg}); //警报(“即将发布”); //event.preventDefault(); /*$.ajax({ 类型:“POST”, url:“post.php”, 数据:{text:clientmsg}, //数据类型:文本, 错误:函数(){ 警报(“接收文本时出错:+响应”); }, 成功:功能(响应){ 警报(“收到提交:+响应”); }, });*/ $(“#usermsg”).attr(“value”,“value”); 返回false; }); 函数notifyNewMessage(){ } //加载包含聊天日志的文件 函数loadLog(){ var oldcollScrollHeight=$(“#聊天盒”).attr(“scrollHeight”)-20;//请求前的滚动高度 $.ajax({ url:“log.html”, cache:false, 成功:函数(html){ if((html.length-$(“#聊天盒”).html().length)!=0){ //警报(“新消息为:“+html+”/n,聊天盒为:“+$(“#聊天盒”).html()); $(“#chatbox”).html(html);//将聊天日志插入#chatbox div var soundCheck=; //警报(声音检查); 如果(声音检查==1){ document.getElementById(“声音”).innerHTML=

这是一个正在进行的废弃工作页面


如果您有任何建议,我们将不胜感激……我很乐意获得教程的链接,只需要指出正确的方向。非常感谢。

可能重复@JeremyHarris,谢谢,但事实并非如此。我正在使用长轮询。我想我想在当前的应用程序中改为更基于套接字的体系结构系统。