• .NET Core下的Socket示例.


    About.schtml中的代码

    @{
        ViewData["Title"] = "About";
    }
    <h2>@ViewData["Title"].</h2>
    <h3>@ViewData["Message"]</h3>
    
    
    <script src="/lib/jquery/dist/jquery.js"></script>
    
    @*<input type="button" value="开始监测!" onclick="location.href='@Url.Action("btnBeginListen_Click", "Home")'" />*@
    
    <input type="button" id="btnBegin" name="btnBegin" value="开始监控!" />
    <input type="text" disabled id="begin_state" value="" />
    <br />
    <input type="text" id="id_msg" name="id_msg" />
    <input type="button" id="btnSub" name="btnSub" value="发送消息." />
    <input type="text" disabled id="id_send_state" value="" />
    
    @*<p>Use this area to provide additional information.</p>*@
    <table border="1" width="960" height="50" align="center" style="text-align:center;font-size:15px;">
        <tr>
            <td>序号</td>
            <td>名称</td>
            <td>服务器地址</td>
            <td>服务器端口</td>
            <td>发送的数据</td>
            <td>接收的数据</td>
        </tr>
    </table>
    
    
    
    <script type="text/javascript">
    
        $(document).ready(function () {
            //发送消息
            $("#btnSub").click(function () {
                var msg = $("#id_msg").val();
                $.ajax({
                    type: "POST",
                    url: "/Home/btnSend_Click",
                    data: {
                        "send_to": "127.0.0.1:42271",
                        "msg_send": msg
                    },
                    success: function (sesponseTest) {
                        alert(sesponseTest);
                        $("#id_send_state").val(sesponseTest);
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $("#id_send_state").val(errorThrown);
                        alert("保存失败:" + errorThrown);
                    }
                });
            });
    
            //开始监控
            $("#btnBegin").click(function () {
                $.ajax({
                    type: "POST",
                    url: "/Home/btnBeginListen_Click",
                    success: function (sesponseTest) {
                        alert(sesponseTest);
                        $("#begin_state").val(sesponseTest);
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        //$("#txt1").val(errorThrown);
                        alert("保存失败:" + errorThrown);
                    }
                });
            });
    
    
    
        });
    
    
    </script>
  • 相关阅读:
    hdu 5171(矩阵快速幂,递推)
    hdu 1316(大整数)
    hdu 5170(数学)
    hdu 5167(dfs)
    hdu 5166(水题)
    hdu 5720(贪心+区间合并)
    BestCoder 2nd Anniversary的前两题
    hdu 3065(AC自动机)
    2.3绘制构造线与射线
    查找ARP攻击源
  • 原文地址:https://www.cnblogs.com/love-zf/p/6405289.html
Copyright © 2020-2023  润新知