Hi

Set the server to bind to 0.0.0.0 and set the client to connect to the
correct IP address of your server (use ifconfig to find this)

HTH


On Wed, Sep 4, 2013 at 8:02 AM, Felipe Silveira <[email protected]>wrote:

> nodejs --version
> v0.10.17
>
>
> On Tuesday, September 3, 2013 11:05:55 AM UTC-3, Felipe Silveira wrote:
>>
>> Hi Guys,
>>
>> I'm trying to implement one example of node js api and I recive this
>> error:
>>
>> node.js:201
>>         throw e; // process.nextTick error, or 'error' event on first tick
>>               ^
>> Error: connect ECONNREFUSED
>>     at errnoException (net.js:670:11)
>>     at Object.afterConnect [as oncomplete] (net.js:661:19)
>>
>>
>> The Example is:
>>
>> var net = require('net');
>> var server = net.createServer(function(c) { //'connection' listener
>>   console.log('Conectou ao Servidor');
>>
>>   c.on('end', function() {
>>     console.log('Disconectou do Servidor');
>>   });
>>   console.log("Conexões: "+server.connections);
>>   c.write('hello\r\n');
>>   console.log(c);
>>   c.pipe(c);
>> });
>> server.listen(9118, function() { //'listening' listener
>>   console.log('Servidor Iniciado');
>>
>> });
>>
>> var client = net.connect({port: 9118},
>>     function() { //'connect' listener
>>   console.log('client connected');
>>   client.write('world!\r\n');
>> });
>> client.on('data', function(data) {
>>   console.log(data.toString());
>>   client.end();
>> });
>> client.on('end', function() {
>>   console.log('client disconnected');
>> });
>>
>>
>> Someone know what is happening?
>>
>> Thank you for help!
>>
>  --
> --
> 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
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Ian Lawrence
Tel: (+55 48) 84933198
E-mail: [email protected]
Web: http://ianlawrence.info
Code: https://github.com/IanLawrence
Author, Professional Ubuntu Mobile Development (Wiley 2009)

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to