FAQ
I am new to Node js

My code is

var headers ;
var options = {

   host: 'google.com',
   port: 80,
           path: '/game/index.php',
                                 method: 'POST',
headers:headers
                      };





function BalanceUpdate(stream ,flag)
{

// console.log("\n BalanceUpdate...................flag"+flag+"\n");
  if(stream != 'undefined' && stream.balance !='NaN ')
   {

   try
  {
      // console.log("\n BalanceUpdate yyyyyyyyyyyyyyyyyy
"+stream.uid+"&balance="+stream.balance+" stream.id = "+stream.id+"\n");
var str = "uid="+stream.uid+"&balance="+stream.balance;
var len =str.length;


// //// console.log("VVVVVVVVVVVVVVPlayer Data From Server :" + str);
options.headers ={'Content-length' : len, 'Content-Type':
'application/x-www-form-urlencoded'}
var request = http.request(options, function (response)
{
  // //// console.log("@@@@@@@@@@@@@@@@@@@@Player Data From Server :" +
str);
response.on('data', function (str)
{
// console.log("\nVVVVVVVVVVVVVV BalanceUpdate Data From Server :" +
str+"\n");
});
response.on('error', function (err)
{
// console.log("\n BalanceUpdate Error From Server response :" + err+"\n");
});

response.on('end', function () {
});
  });
request.write( str +"\0");
  request.on('error', function (err)
{
  // console.log("\n BalanceUpdate Error From Server request:" + err+"\n");
});
  // the data to POST needs to be a string or a buffer
  request.end();
    }

  catch (err )
  {
// console.log("\n BalanceUpdate Update Error "+err+"\n");
  }
  }

  else
  {
  // console.log("\n BalanceUpdate zzzzzzzzzzzzzzzzzzzzzzz
"+stream.uid+"&balance="+stream.balance+" stream.id = "+stream.id+"\n");
  }


}


Some time it works ,some times not. Please help me

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 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 unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/4ba319c2-67ec-4501-acd3-5fe344c517c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Liju Thomas at Nov 4, 2014 at 3:43 pm
    My code is

    I am new to Node.js

    var headers ;

    var options = {


       host: 'google.com',

       port: 80,

           path: '/game/index.php/',

                                 method: 'POST',

    headers:headers

       };


    function BalanceUpdate(stream ,flag)

    {


    // console.log("\n BalanceUpdate...................flag"+flag+"\n");

      if(stream != 'undefined' && stream.balance !='NaN ')

       {



       try

      {

          // console.log("\n BalanceUpdate yyyyyyyyyyyyyyyyyy
    "+stream.uid+"&balance="+stream.balance+" stream.id = "+stream.id+"\n");

    var str = "uid="+stream.uid+"&balance="+stream.balance;

    var len =str.length;



    // //// console.log("VVVVVVVVVVVVVVPlayer Data From Server :" + str);

    options.headers ={'Content-length' : len, 'Content-Type':
    'application/x-www-form-urlencoded'}

    var request = http.request(options, function (response)

    {

      // //// console.log("@@@@@@@@@@@@@@@@@@@@Player Data From Server :" +
    str);

    response.on('data', function (str)

    {

    // console.log("\nVVVVVVVVVVVVVV BalanceUpdate Data From Server :" +
    str+"\n");

    });

    response.on('error', function (err)

    {

    // console.log("\n BalanceUpdate Error From Server response :" + err+"\n");

    });


    response.on('end', function () {

    });

      });

    request.write( str +"\0");

      request.on('error', function (err)

    {

      // console.log("\n BalanceUpdate Error From Server request:" + err+"\n");

    });

      // the data to POST needs to be a string or a buffer

      request.end();

        }



      catch (err )

      {

    // console.log("\n BalanceUpdate Update Error "+err+"\n");

      }

      }



      else

      {

      // console.log("\n BalanceUpdate zzzzzzzzzzzzzzzzzzzzzzz
    "+stream.uid+"&balance="+stream.balance+" stream.id = "+stream.id+"\n");

      }



    }


    Some times it works , some times not . Please help me

    --
    Job board: http://jobs.nodejs.org/
    New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
    Old group rules: 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 unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
    To post to this group, send email to nodejs@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/8ccff112-e4c8-4cce-be70-3803fc29ceae%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Christopher Rust at Nov 4, 2014 at 8:59 pm
    What sort of errors do you get?

    Is google.com/game/index.php actually expected to exist?
    On Nov 4, 2014 9:43 AM, "Liju Thomas" wrote:

    I am new to Node js

    My code is

    var headers ;
    var options = {

    host: 'google.com',
    port: 80,
    path: '/game/index.php',
    method: 'POST',
    headers:headers
    };





    function BalanceUpdate(stream ,flag)
    {

    // console.log("\n BalanceUpdate...................flag"+flag+"\n");
    if(stream != 'undefined' && stream.balance !='NaN ')
    {

    try
    {
    // console.log("\n BalanceUpdate yyyyyyyyyyyyyyyyyy
    "+stream.uid+"&balance="+stream.balance+" stream.id = "+stream.id+"\n");
    var str = "uid="+stream.uid+"&balance="+stream.balance;
    var len =str.length;


    // //// console.log("VVVVVVVVVVVVVVPlayer Data From Server :" + str);
    options.headers ={'Content-length' : len, 'Content-Type':
    'application/x-www-form-urlencoded'}
    var request = http.request(options, function (response)
    {
    // //// console.log("@@@@@@@@@@@@@@@@@@@@Player Data From Server :" +
    str);
    response.on('data', function (str)
    {
    // console.log("\nVVVVVVVVVVVVVV BalanceUpdate Data From Server :" +
    str+"\n");
    });
    response.on('error', function (err)
    {
    // console.log("\n BalanceUpdate Error From Server response :" + err+"\n");
    });

    response.on('end', function () {
    });
    });
    request.write( str +"\0");
    request.on('error', function (err)
    {
    // console.log("\n BalanceUpdate Error From Server request:" + err+"\n");

    });
    // the data to POST needs to be a string or a buffer
    request.end();
    }

    catch (err )
    {
    // console.log("\n BalanceUpdate Update Error "+err+"\n");
    }
    }

    else
    {
    // console.log("\n BalanceUpdate zzzzzzzzzzzzzzzzzzzzzzz
    "+stream.uid+"&balance="+stream.balance+" stream.id = "+stream.id+"\n");
    }


    }


    Some time it works ,some times not. Please help me

    --
    Job board: http://jobs.nodejs.org/
    New group rules:
    https://gist.github.com/othiym23/9886289#file-moderation-policy-md
    Old group rules:
    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 unsubscribe from this group and stop receiving emails from it, send an
    email to nodejs+unsubscribe@googlegroups.com.
    To post to this group, send email to nodejs@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/nodejs/4ba319c2-67ec-4501-acd3-5fe344c517c3%40googlegroups.com
    <https://groups.google.com/d/msgid/nodejs/4ba319c2-67ec-4501-acd3-5fe344c517c3%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    Job board: http://jobs.nodejs.org/
    New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
    Old group rules: 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 unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
    To post to this group, send email to nodejs@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAMT%3Dzo4k%3DRcyOWtu_5JsvL4Si55_50jjfo9gcgv0zCxsXAUpMQ%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupnodejs @
categoriesnodejs
postedNov 4, '14 at 3:43p
activeNov 4, '14 at 8:59p
posts3
users2
websitenodejs.org
irc#node.js

2 users in discussion

Liju Thomas: 2 posts Christopher Rust: 1 post

People

Translate

site design / logo © 2022 Grokbase