Hello my code exits after some time (10 minutes or just a minute) and no
error in console.

Can someone tell me why?


xmlrpc = require("xmlrpc")

args=process.argv.splice(2)
comName = args[0]
host=args[1]
port=args[2]
console.log("RFID at :"+comName+" Remote Server at:"+host+" port:"+port)
SerialPort = require("serialport2").SerialPort
client = xmlrpc.createClient(
  host: host
  port: port
  path: "/EMPRE/default/call/xmlrpc"
)
sp = new SerialPort()
sp.open comName,
  baudRate: 9600
  dataBits: 8
  parity: "none"
  stopBits: 1
  flowControl: false
readData = ""
sp.on "data", (data) ->
  readData += data.toString()
  if readData.length is 14
    console.log '\u001b[0m'
    console.log readData
    client.methodCall "RFID", [readData], (error, value) ->
      console.log "error no webservice",error,value
    readData = ""

#PROCESS ERRORS!!!!
sp.on 'error',(erro)->
  console.log "erro no serial",erro

process.on "exit", (erro)->
  console.log "Sintaxe: coffee rfid.coffee COM[x] [IP] [port]",erro
  console.log '\u001b[0m'

process.on 'SIGINT',->
  console.log 'detectado exit forçado pelo user..'

process.on "uncaughtException" ,(erro)->
  console.log "erro inesperado",erro
console.log "\u001b[36m"
console.log new Date()

process.on "error", ->
  console.log "error desconhecido"

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