JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java & XML、Web Service  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 cordova TCP client
roytsang





發文: 618
積分: 1
於 2017-10-06 08:48 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
小弟想在用cordova 來開發一個TCP client application, 請問有什麼東西安裝和configure先可以work到呢?
這是我的index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="format-detection" content="telephone=no">
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/bb.js"></script>
    </head>
    <body>
        <div id="page" data-role="page" >
            <div data-role="content">
              <h2>Admin. Server Login</h2>
              <form method="post" id="loginForm">
                <label for="password">User:</label> 
                <input class="required" type="text" name="username" id="username"
                  placeholder="username@server.com"> 
                <label for="password">Password:</label>
                <input class="required" type="password" name="password"
                  id="password" placeholder="password">
                <label for="password">Server Name/IP address:</label>
                <input class="required" type="text" name="serverName"
                  id="serverName" placeholder="server">                   
                <label for="password">Server Port:</label>
                <input class="required" type="number" name="serverPort"
                  id="serverPort" placeholder="4466" min="1">                 
 
                <input type="button" data-theme="b"
                  value="Login" id="submitButton" onClick="handleLogin(this.form)">
              </form>
            </div>
        </div>
    </body>
</html>

這是bb.js 的內容:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    function handleLogin(v)
{
    chrome.socket.create("tcp", null, function(createInfo) {
        alert(createInfo.socketId);
        theSocketId = createInfo.socketId;
        chrome.socket.connect(theSocketId, "www.yahoo.com", 80, function(result) {
            alert(result);
            if (result === 0) {
                chrome.socket.read(theSocketId, 1000, function(readInfo) {
                    alert(readInfo.resultCode);
                });
            }
        });
    });
}

當我run 這個app 時,就出現以下error message:

Uncaught TypeError: Cannot read property 'create' of undefined

我的cordova version 是7.0.1
我的npm version 是3.10.10.


reply to postreply to post
» JWorld@TW »  Java & XML、Web Service

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8