vagrant上のcentOSでnodejsで作ったTCPエコーサーバにtelnetで通信をしたいのですが行き詰まってるので教えて下さい。
サーバ起動後、サーバが待機状態に入り、
linux
1[vagrant@vagrant-centos64 tcp]$ node tcp_echo_server.js 2Listening Start on Server - 192.168.33.10:8888 3connections property is deprecated. Use getConnections() method 4Connection start (1/3) - 192.168.33.10:58148 5/home/vagrant/tcp/tcp_echo_server.js:31 6 clients[key] = new Client(socket); 7 ^ 8ReferenceError: clients is not defined 9 at Server.<anonymous> (/home/vagrant/tcp/tcp_echo_server.js:31:2) 10 at Server.emit (events.js:129:20) 11 at TCP.onconnection (net.js:1332:8)
別ターミナルからクライアントへ接続しようとすると
linux
1[vagrant@vagrant-centos64 ~]$ telnet 192.168.33.10 8888 2Trying 192.168.33.10... 3Connected to 192.168.33.10. 4Escape character is '^]'. 5Connection closed by foreign host.
「Connection closed by foreign host.」とエラーが出てしまいます。
node
1// 省略 2// nodejsサーバ 3server.listen(8888, '192.168.33.10', function(){ 4 var addr = server.address(); 5 console.log('Listening Start on Server - ' + 6 addr.address + ':' + addr.port); 7}); 8// 省略
linux
1// host確認 2$ hostname 3vagrant-centos64.vagrantup.com 4 5$ uname -a 6Linux vagrant-centos64.vagrantup.com 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux 7 8// 設定事項 9$ vim /etc/sysconfig/network 10HOSTNAME=vagrant-centos64.vagrantup.com 11NETWORKING=yes 12 13$ hostname vagrant-centos64.vagrantup.com 14 15$ vim /etc/resolv.conf 16; generated by /sbin/dhclient-script 17search tokyo_net.hal.ac.jp vagrantup.com 18nameserver 10.0.2.3 19 20$ vim etc/hosts 21127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 22::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 23192.168.33.10 vagrant-centos64.vagrantup.com
困っているので教えて下さい。よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。