Phidget Network Server: Difference between revisions

From Phidgets Support
Line 26: Line 26:
[[Image:NetworkServer_PhidgetServer.jpg|link=|800px]]
[[Image:NetworkServer_PhidgetServer.jpg|link=|800px]]


- how does it work
When you open a Phidget, you have the option of opening it '''locally''' or '''remotely'''.


<picture of normal phidgets setup>
Opening a Phidget '''locally''' means communicating with it directly. You can only locally open Phidgets that are physically connected to the computer running your program.


<picture of setup with discovery enabled>
Opening a Phidget '''remotely''' means communicating with it using the Network Service. You can remotely open any Phidget on your network, even ones that are physically connected to the computer running your program.
 
Why would you want to remotely open a Phidget that's physically attached to the computer? Well, a Phidget channel that is opened locally cannot be accessed by any other computer for as long as it's opened. A Phidget channel that is remotely opened, on the other hand, can be simultaneously opened by any number of programs.
 
<image showing opening a phidget from multiple sources over network>
 
== Setting up the Network Server ==


- how to set it up
- how to set it up

Revision as of 21:30, 28 April 2017

General Overview

The Phidget Network Server is a feature of Phidgets that makes it possible to control or interact with Phidgets connected to other computers on your local network. To understand how it works, let's first take a look at what a system looks like without the Network Server enabled:



Phidgets without NetworkServer.jpg


At the top you have your computer, which has the Phidgets drivers installed. Connected via USB are a number of USB Phidgets and/or VINT Hubs. Connected to the VINT Hubs could be VINT devices.


All of these connected Phidgets have various channels that can be opened, which allow the program running on your computer to read data from them or control their various parts.


Since the Network Server is disabled in this diagram, this computer is the only one that will be able to access these Phidgets.


Once the Phidget Network Server is enabled, your computer hosts a Phidget Server which broadcasts all connected Phidgets to other computers on your network. When another computer tries to open a channel, your Phidgets will be included in the list it selects the channel from.

NetworkServer PhidgetServer.jpg

When you open a Phidget, you have the option of opening it locally or remotely.

Opening a Phidget locally means communicating with it directly. You can only locally open Phidgets that are physically connected to the computer running your program.

Opening a Phidget remotely means communicating with it using the Network Service. You can remotely open any Phidget on your network, even ones that are physically connected to the computer running your program.

Why would you want to remotely open a Phidget that's physically attached to the computer? Well, a Phidget channel that is opened locally cannot be accessed by any other computer for as long as it's opened. A Phidget channel that is remotely opened, on the other hand, can be simultaneously opened by any number of programs.

<image showing opening a phidget from multiple sources over network>

Setting up the Network Server

- how to set it up

- it can be mobile, too

Network Server on a Phidget Single Board Computer

The Phidget Single Board Computer (SBC) can provide a compact, inexpensive way to easily run the Network Server. It runs the Network Server in the background automatically from the moment you turn it on, and allows you to read from and control all Phidgets attached to it:

<<picture of SBC setup>>

This can allow for a compact, mobile-based system like this:

<<picture of SBC with mobile>>?

The SBC runs Linux, which provides a full operating system on which to develop code, serve web pages, and control Phidgets.

Using The Network Server

Each Operating System page has a section on how to use the Network Server on that operating system:

The operating systems pages have complete examples on how to set up a network server process and using it to remotely control or gather data from Phidgets. The pages also tell you how to start and stop the Network Server on your computer, and how to run it with or without mDNS (Bonjour, avahi, etc).

Examples

Below are some quick examples showing how simple it is to open a Phidget remotely over the Network Server:

C/C++

Phidget_setDeviceSerialNumber((PhidgetHandle) device, 37299);
Phidget_setIsRemote((PhidgetHandle) device, 1);

Phidget_open((PhidgetHandle) device);
CPhidget_openRemoteIP ((CPhidgetHandle) device, serial_number, "127.0.0.1", 5001, NULL);

C#

Java

Python

Configuration File

- how to find config file - explain the options

Troubleshooting

When using the Network Server, both the client and server should have the same version of the Network Server installed. The easiest way to ensure this is to update your libraries on both ends.

For other troubleshooting tips, try our General Troubleshooting page, in its Network Server section.