草庐IT

listening

全部标签

android - 方法 'listen' 没有为类 'Function' 定义?

大家好,我正在尝试构建一个flutter来显示纬度和经度,但我仍然在代码中遇到错误:voidinitState(){super.initState();//Defaultvariableset0currentLocation['latitude']=0.0;currentLocation['longtitude']=0.0;initPlatformState();locationSubscription=location.onLocationChanged.listen((Mapresult){setState((){currentLocation=result;});});}

node.js - Redis on message listener 触发了两次

我正在使用NodeJS和Redis开发聊天应用程序,为什么我使用Redis订阅,因为我需要在用户登录时通知其他用户,当用户第一次登录时我的问题就开始了它工作正常onmessagelistener调用了一次,但是当同一个用户刷新页面时,发现publish方法被调用了两次。这是我使用的代码示例:varredisClient=redis.createClient({auth_pass:password});varmyServer;myServer=require('http').createServer(app);varsocketIo=require('socket.io').listen

python - Tornado -redis : Why the 'listen' and the 'brpop' of tornado-redis can't work at the same time

代码如下:fromtornadoredisimportClientfromtornado.ioloopimportIOLoopfromtornado.genimportcoroutine,Taskrds=Client()@coroutinedeflisten_pub():defhandle(msg):printmsgyieldTask(rds.subscribe,channels='pub')rds.listen(handle)@coroutinedeflisten_list():whileTrue:res=yieldTask(rds.brpop,keys='list')printre

python - redis python psubscribe 事件回调,不调用.listen()

我正在尝试使用python订阅redis中的键空间事件。我希望在调用.psubscribe()后不要将for循环与.listen()一起使用。这可能吗?我已使用KEA启用所有键空间事件。defsubscribe(self,key,handler):#thisfunctionnevergetscalled,ifIdon'taddthefor-loopwithlisten()belowdefevent_handler(msg):print('Handler',msg)redis_server=StrictRedis(host='localhost',port=6379,db=0)pubsu

networking - server.listen(port, '127.0.0.1') 无法访问容器化节点服务器

我在Docker中建立了一个简单的Node服务器。DockerfileFROMnode:latestRUNapt-get-yupdateADDexample.js.EXPOSE1337CMDnodeexample.jsexample.jsvarhttp=require('http');http.createServer(function(req,res){res.writeHead(200,{'Content-Type':'text/plain'});res.end('HelloWorld\n'+newDate);}).listen(1337,'127.0.0.1');console.

networking - server.listen(port, '127.0.0.1') 无法访问容器化节点服务器

我在Docker中建立了一个简单的Node服务器。DockerfileFROMnode:latestRUNapt-get-yupdateADDexample.js.EXPOSE1337CMDnodeexample.jsexample.jsvarhttp=require('http');http.createServer(function(req,res){res.writeHead(200,{'Content-Type':'text/plain'});res.end('HelloWorld\n'+newDate);}).listen(1337,'127.0.0.1');console.

go - Go 的 net.Listener Addr() 有什么用?

Go的net.Listener界面看起来像这样:typeListenerinterface{//Acceptwaitsforandreturnsthenextconnectiontothelistener.Accept()(Conn,error)//Closeclosesthelistener.//AnyblockedAcceptoperationswillbeunblockedandreturnerrors.Close()error//Addrreturnsthelistener'snetworkaddress.Addr()Addr}但是Addr实际上是用来做什么的呢?如果我必须实现

networking - 如何知道 net.Listener 何时正确关闭?

我有以下代码:server:=&http.Server{Addr:addr,Handler:r}l,err:=net.Listen("tcp",addr)iferr!=nil{logging.Error("Failedopeningsocket:%s",err)}iferr:=server.Serve(l);err!=nil{//errorhandling}当l.Close()被调用时,server.Serve(l)将退出并出错。我想知道这是否真的是一个错误,或者只是有人调用l.Close()的结果(这对我来说不是错误)。有没有正确的方法来做到这一点? 最佳

go - golang 中的 UDP,Listen 不是阻塞调用?

我正在尝试使用UDP作为协议(protocol)在两台计算机之间创建双向channel。也许我不明白net.ListenUDP的意义。这不应该是一个阻塞调用吗?正在等待客户端连接?addr:=net.UDPAddr{Port:2000,IP:net.ParseIP("127.0.0.1"),}conn,err:=net.ListenUDP("udp",&addr)//codedoesnotblockheredeferconn.Close()iferr!=nil{panic(err)}vartestPayload[]byte=[]byte("Thisisatest")conn.Write

git - ssh 不工作,muxserver_listen bind() : No such file or directory

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。这个问题似乎不是关于aspecificprogrammingproblem,asoftwarealgorithm,orsoftwaretoolsprimarilyusedbyprogrammers的.如果您认为这个问题是关于anotherStackExchangesite的主题,您可以发表评论,说明问题可能在哪里得到解答。关闭7年前。Improvethisquestion今天在我的新工作笔记本电脑上我根本无法使用ssh(ssh进入服务器、bitbucket等不工作),它因以下错误而失败:fatal:C