I'm fairly sure i'm monitoring the right interfaces. The "other data" is 
coming trough. Just not the data incoming from "createConnection"

Op maandag 26 november 2012 01:58:26 UTC+1 schreef Ben Noordhuis het 
volgende:
>
> On Sun, Nov 25, 2012 at 11:23 AM, Bastian v.d Boomgaard 
> <[email protected] <javascript:>> wrote: 
> > I'm sending messages trough a socket connection to a device. The device 
> > sends a message on which i need to respond. 
> > 
> > This is my code for opening a socket connection: 
> > 
> >     var lPORT = 4102; 
> >     // Create a server instance, and chain the listen function to it 
> >     net.createServer(function(sock) { 
> > 
> >         // We have a connection - a socket object is assigned to the 
> > connection automatically 
> >         console.log('TCP LISTENER hearing on: ' + sock.remoteAddress 
> +':'+ 
> > sock.remotePort); 
> > 
> >         // Event handler: incoming data 
> >         sock.on('data', function(data) { 
> >             sock.allowHalfOpen = true; 
> >         sock.pipe(sock); 
> >         var sockwrite = sock.write(data+'\r\n'); 
> >         if (sockwrite == true) { 
> >             console.log(''+data); 
> >             } 
> > 
> >         // Write incoming messages to logfile. 
> >         var log = fs.createWriteStream('pin.log', {'flags': 'a'}); 
> >         log.write(data+'\n\r\n\r'); 
> > 
> >         // Push incoming messages to client 
> >        io.of('/process').emit( 'broadcast_msg', ''+data); 
> > 
> >         }); 
> > 
> >         // Event handler: close connection 
> >         sock.on('close', function(data) { 
> >             console.log('[LISTENER] Connection paused.'); 
> >         }); 
> > 
> >     }).listen(lPORT); 
> > 
> > Beneath is the code for connecting to that socket connection and sending 
> the 
> > data. But that data is not physicly send to the socket, i checked this 
> with 
> > wireshark. The message send from this code is not send. 
> > 
> >     var returnsock = net.createConnection(4102, function() { 
> >         returnsock.write(msg); 
> >     }); 
> > 
> > 
> > The point is, that the data send from "returnsock.write(msg);" **does** 
> come 
> > trough in the code above, i can see that when i view my console.log. So, 
> > "var sockwrite = sock.write(data+'\r\n');" comes back with "true". 
> > 
> > My question is: Why is the data that is send from 
> "returnsock.write(msg)" 
> > come tru to the server, but is not send inside the socket with "var 
> > sockwrite = sock.write(data+'\r\n')"? 
>
> You mean why you don't see any traffic in wireshark?  Probably because 
> you're monitoring the wrong interface or your capture rule doesn't 
> actually catch the right traffic. 
>
> Try tracing syscalls instead.  There's strace on Linux and dtruss on 
> OS X, Solaris and the BSDs. 
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to