Author Topic: Networking in a Script  (Read 3473 times)

Offline CraigNZ

  • PixInsight Enthusiast
  • **
  • Posts: 94
Networking in a Script
« on: 2016 December 07 12:48:00 »
Has anyone written a script to receive and send UDP packets?  The idea here is for one or more external programs to send 'requests' to a script running on PI.  The script would process the script (e.g., running a calibration on an image) and return a result to the requestor.  UDP is much easier to use because you do not have to setup and maintain a TCP session.

If there is no script, is the Network class in SpiderMonkey available in PI?

Offline CraigNZ

  • PixInsight Enthusiast
  • **
  • Posts: 94
Re: Networking in a Script
« Reply #1 on: 2016 December 07 12:58:56 »
A possible alternative is use to use some form of file event scripting where the script monitors a folder and when a new file appears in the folder, it is read and processed similar to a UDP message.

Has anyone tried this?

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: Networking in a Script
« Reply #2 on: 2016 December 08 09:56:24 »
Craig, there is a FileWatcher core PJSR object, see this thread.

Events are async and dir change info is limited, it appears you need to find what changed yourself.

Thanks,
Mike

Offline CraigNZ

  • PixInsight Enthusiast
  • **
  • Posts: 94
Re: Networking in a Script
« Reply #3 on: 2016 December 08 20:46:50 »
Thanks Mike .. I'll check it out.