Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js nodejstcp套接字写入_Node.js_Sockets_Apache Flex - Fatal编程技术网

Node.js nodejstcp套接字写入

Node.js nodejstcp套接字写入,node.js,sockets,apache-flex,Node.js,Sockets,Apache Flex,我无法将一些数据写入nodejs中的tcp套接字 下面是我要替换的adobe flex代码 private function SendRequestHello():void { writeUnsignedInt( 0); /* Request Type. */ writeUnsignedInt( 16);

我无法将一些数据写入nodejs中的tcp套接字

下面是我要替换的adobe flex代码

private function SendRequestHello():void
{
    writeUnsignedInt( 0);                                                   /* Request Type. */
    writeUnsignedInt( 16);                                                  /* Length. */
    writeByte( OPCODE_HELLO);                                               /* Opcode. */
    writeUnsignedInt( m_nOwnID / 0x100000000);                              /* GPS Server ID. */
    writeUnsignedInt( m_nOwnID & 0xffffffff);                               /* GPS Server ID part 2. */
    writeUnsignedInt( 3 << 24);                                             /* GPS Server Version (my version). */
    writeUnsignedInt( 3 << 24);                                             /* Oldest supported Server Version. */
    FlushWithCatch();
}
私有函数SendRequestHello():void
{
writeUnsignedInt(0);/*请求类型*/
writeUnsignedInt(16);/*长度*/
writeByte(操作码);/*操作码*/
writeUnsignedInt(m_nOwnID/0x100000000);/*GPS服务器ID*/
writeUnsignedInt(m_nOwnID&0xffffffff);/*GPS服务器ID第2部分*/
writeUnsignedInt(3My solution

var buffer = new Buffer(25);
var writer = new BinaryWriter(buffer);
writer.writeUInt32BE(0);            
writer.writeUInt32BE(16);           
writer.writeUInt8(1);                           
writer.writeUInt32BE(client.AppID / 0x100000000);   
writer.writeUInt32BE(client.AppID & 0xffffffff);    
writer.writeUInt32BE(3 << 24);                      
writer.writeUInt32BE(3 << 24);                      

client.fwd.write(buffer);
var缓冲区=新缓冲区(25);
var writer=新的二进制编写器(缓冲区);
writer.writeUInt32BE(0);
作者:writeUInt32BE(16);
作者:书面材料8(1);
writer.writeUInt32BE(client.AppID/0x100000000);
writeUInt32BE(client.AppID&0xffffffff);
writer.writeUInt32BE(3
TypeError: invalid data
at Socket.write (net.js:617:11)
at Socket.<anonymous> (C:\**\index.js:84:30)
at Socket.g (events.js:260:16)
at emitNone (events.js:72:20)
at Socket.emit (events.js:166:7)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1045:10)
var buffer = new Buffer(25);
var writer = new BinaryWriter(buffer);
writer.writeUInt32BE(0);            
writer.writeUInt32BE(16);           
writer.writeUInt8(1);                           
writer.writeUInt32BE(client.AppID / 0x100000000);   
writer.writeUInt32BE(client.AppID & 0xffffffff);    
writer.writeUInt32BE(3 << 24);                      
writer.writeUInt32BE(3 << 24);                      

client.fwd.write(buffer);