zoukankan      html  css  js  c++  java
  • .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>
  • 相关阅读:
    kernel reported iSCSI connection 1:0 error (1022-Invalid or unknown error code) state (3)
    [Visual Studio] pdb 和 exe 不match的情况
    What is the Makefile Target `.c.o` for?
    [Inno Setup] 区分Windows版本的一个例子
    CFLAGS [Makefile]
    Python 安装第三方插件时,报错 unable to find vcvarsall.bat
    【Inno Setup】Windows 版本号
    正则应用
    正则search与match的区别
    还是正则基础
  • 原文地址:https://www.cnblogs.com/love-zf/p/6405289.html
Copyright © 2011-2022 走看看