我正在使用我购买的新脚本,并且我一直收到此套接字错误:
GET https://127.0.0.1:8081/socket.io/1/?t=1432947339492 net::ERR_CONNECTION_REFUSED
据我所知,配置文件是正确的。
socket = io.connect( 'https://127.0.0.1:8081' );
和
var socket = require( 'socket.io' );
var express = require( 'express' );
var http = require( 'https' );
var app = express();
var server = http.createServer( app );
var io = socket.listen( server );
io.set('transports',['xhr-polling']);
io.sockets.on( 'connection', function( client ) {
console.log( "New client !" );
client.on( 'message', function( data ) {
console.log( 'Message received ' + data.name + ":" + data.message );
//client.broadcast.emit( 'message', { name: data.name, message: data.message } );
io.sockets.emit( 'message', data);
});
client.on( 'doTrade', function( data ) {
//console.log( 'Message received ' + data.name + ":" + data.message );
io.sockets.emit( 'doTrade', data );
});
});
server.listen( 8081 );
我试过这个(我正在使用linux,debian):
root@Crypto:~# nc 127.0.0.1 8081 < /dev/null; echo $?
(UNKNOWN) [127.0.0.1] 8081 (tproxy) : Connection refused
1
root@Crypto:~# nc 127.0.0.1 80 < /dev/null; echo $?
0
其中0 =开放,1 =关闭。
我猜这可能是连接被拒绝的原因,但我不知道如何解决。
任何人都可以提出解决方案来阻止连接被拒绝。
感谢。
答案 0 :(得分:0)
看起来没有什么东西正在侦听端口8081.启动服务器之后,做了什么:
ALTER PROCEDURE [dbo].[uspApprovalHistory]
-- Add the parameters for the stored procedure here
@empID int = null
AS
BEGIN
declare @SRFTable table
(SRFID nvarchar(50))
declare @currSRFID nvarchar(50) = null
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
insert into @SRFTable
Select distinct MasterCode from CallForwarding
Where EmployeeNo = @empID or ApproverNo = @empID;
Select * From callforwarding
Where Mastercode in (select SRFID from @SRFTable)
and ApproverNo = @empID
and ForwardDate in (Select max(ForwardDate) from CallForwarding
where Mastercode in (select SRFID from @SRFTable)
and ApproverNo = @empID)
END
显示?