File: telnet.html

package info (click to toggle)
python-autobahn 17.10.1%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,452 kB
  • sloc: python: 22,598; javascript: 2,705; makefile: 497; sh: 3
file content (54 lines) | stat: -rw-r--r-- 2,116 bytes parent folder | download | duplicates (6)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<html>
    <head>
        <title>Telnet client using WebSocket</title>
        <script src="telnet/base64.js"></script>
        <script src="telnet/util.js"></script>
        <script src="telnet/websock.js"></script>
        <script src="telnet/webutil.js"></script> 
        <script src="telnet/keysym.js"></script> 
        <script src="telnet/VT100.js"></script> 
        <script src="telnet/wstelnet.js"></script> 
    </head>
    <body>
        <p>Telnet client example code from the <a href="https://github.com/kanaka/websockify">Websockify project</a>!</p>
        Host: <input id="host" style="width:100" type="text" value="192.168.1.37" />&nbsp;
        Port: <input id="port" style="width:50" type="text" value="9000" />&nbsp;
        Encrypt: <input id='encrypt' type='checkbox'>&nbsp;
        <input id='connectButton' type='button' value='Connect' style='width:100px' onclick="connect();">&nbsp;
        <br><br>
        <pre id="terminal"></pre>
        <script>
            var telnet;

            function connect() {
                telnet.connect($D('host').value,
                               $D('port').value,
                               $D('encrypt').checked);
                $D('connectButton').disabled = true;
                $D('connectButton').value = "Connecting";
            }

            function disconnect() {
                $D('connectButton').disabled = true;
                $D('connectButton').value = "Disconnecting";
                telnet.disconnect();
            }

            function connected() {
                $D('connectButton').disabled = false;
                $D('connectButton').value = "Disconnect";
                $D('connectButton').onclick = disconnect;
            }

            function disconnected() {
                $D('connectButton').disabled = false;
                $D('connectButton').value = "Connect";
                $D('connectButton').onclick = connect;
            }

            window.onload = function() {
                telnet = Telnet('terminal', connected, disconnected);
            }
        </script>
    </body>
</html>