按照node.js权威指南这本书敲的代码:vardgram=require('dgram');varserver=dgram.createSocket('udp4');server.on('listening',function(){server.setMulticastTTL(128);server.addMembership('230.185.192.108');});setInterval(broadCast,1000);functionbroadCast(){varbuf=newBuffer((newDate()).toLocaleString());server.send(buf,buf.length,8000,'230.185.192.108');}为毛报这样的错啊?我的port是8000,肯定小于65536啊dgram.js:339thrownewRangeError('Portshouldbe>0and<65536');^RangeError:Portshouldbe>0and<65536atSocket.send(dgram.js:339:11)atTimeout.broadCast[as_onTimeout](C:\Users\quan.sun\Desktop\js\node\demo1.js:12:12)atontimeout(timers.js:386:14)attryOnTimeout(timers.js:250:5)atTimer.listOnTimeout(timers.js:214:5)
哔哔one
波斯汪
相关分类