得到一个;“外部主机关闭的连接”;使用Ruppell';在Heroku上托管TCP服务器时出错;s套接字插件
我正在尝试在Heroku上托管一个简单的TCP服务器 我在用电脑。我的proc文件如下所示:得到一个;“外部主机关闭的连接”;使用Ruppell';在Heroku上托管TCP服务器时出错;s套接字插件,heroku,tcp,Heroku,Tcp,我正在尝试在Heroku上托管一个简单的TCP服务器 我在用电脑。我的proc文件如下所示: web: bundle exec ruby web.rb -e "production" -p $PORT socket: ./lib/sockets-connect/rs-conn ruby ./tcpserver.rb require 'eventmachine' module EchoServer def post_init puts "-- someone connecte
web: bundle exec ruby web.rb -e "production" -p $PORT
socket: ./lib/sockets-connect/rs-conn ruby ./tcpserver.rb
require 'eventmachine'
module EchoServer
def post_init
puts "-- someone connected to the echo server!"
end
def receive_data data
send_data ">>>you sent: #{data}"
close_connection if data =~ /quit/i
end
def unbind
puts "-- someone disconnected from the echo server!"
end
end
EventMachine.run {
EventMachine.start_server "127.0.0.1", ENV['RUPPELLS_SOCKETS_LOCAL_PORT'], EchoServer
}
tcpserver.rb如下所示:
web: bundle exec ruby web.rb -e "production" -p $PORT
socket: ./lib/sockets-connect/rs-conn ruby ./tcpserver.rb
require 'eventmachine'
module EchoServer
def post_init
puts "-- someone connected to the echo server!"
end
def receive_data data
send_data ">>>you sent: #{data}"
close_connection if data =~ /quit/i
end
def unbind
puts "-- someone disconnected from the echo server!"
end
end
EventMachine.run {
EventMachine.start_server "127.0.0.1", ENV['RUPPELLS_SOCKETS_LOCAL_PORT'], EchoServer
}
RUPPELLS\u SOCKETS\u FRONTEND\u URI
istcp://22405.339f7303-45df-4e9c-a049-5a15c47168ab.sockets.ruppells.io:22405/
当我使用telnet时tcp://22405.339f7303-45df-4e9c-a049-5a15c47168ab.sockets.ruppells.io 22405
,我获得了一个由外部主机关闭的连接。
我对TCP几乎没有经验。你知道我该如何解决这个问题吗?对于其他正在解决这个问题的人,你的本地服务器必须绑定到
0.0.0
,而不是127.0.0.1请注意,Ruppell的Sockets是一个alpha附加组件,不开放给所有人使用。