Phidget Network Server: Difference between revisions

From Phidgets Support
 
(65 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Category:Overview]]
[[Category:Programming]]{{Recommended_Flow_Links|{{Flow Page Number|{{PAGENAME}} }} }}
__TOC__
__NOTOC__
==What Is the Phidget Network Server?==
The Phidget Network Server is a tool that makes it easy to access Phidgets that are connected to '''other computers''' on your network.


==General Overview==
It also enables in-browser JavaScript applications with Phidgets, and provides a dictionary manager which can be used to share information between applications.


The Phidget WebService is a background process that broadcasts all events and data from a USB Phidget over the network:
===Without the Phidget Network Server===
Your application runs on the same computer that your Phidgets are connected to.
[[Image:Networkserver_ex1v2.png|500px|center|link=]]


[[Image:webservice_general_broadcast.png|700px|link=|alt=]]
===With the Phidget Network Server===
Your Phidgets are connected to a computer running the Phidget Network Server. The Phidget Network Server hosts a Phidget Server, which makes your Phidgets available to other computers on your network.
* Your application(s) can run on any computer that has access to the network the host is on.
* Multiple applications can access the Phidgets simultaneously, with some exceptions (e.g. motor controllers).


It uses '''link local addressing''' which allows you to use simple server names in your code. The link local addressing is provided by the programs Bonjour, avahi, or mDNSResponder, depending on your system, and the correct program is either installed already or with the Phidget libraries.
[[Image:Networkserver_ex2v3.png|600px|center|link=]]


You can listen to the Phidget data and control the Phidgets over the network using '''one or more''' computers. You can still use the Phidget on the computer it is directly connected to, just by using a remote version of the {{Code|open()}} call in your local code:
==Phidget Network Server Hosts==
As mentioned above, a computer is required to host the Phidget Network Server. Any Windows, macOS, or Linux machine can act as a host. '''The Wireless VINT Hub or the PhidgetSBC4 are also excellent, compact choices.'''
[[Image:HUB5000_0.jpg|200px|thumb|link=]]
===Wireless VINT Hub===
The Wireless VINT Hub (HUB5000) has the Phidget Network Server built-in. Simply connect your Phidgets, power the device, and the Network Server starts automatically.


[[Image:webservice_general_pctopc.png|700px|link=|alt=]]
This device supports both Ethernet and WiFi connections and provides a simple web interface to configure your Phidget Network Server. Check out the [{{SERVER}}/?prodid=1143 product page] for more information.


Since Phidgets supports many operating systems, the listening and controlling computer doesn't have to be a computer.... it could be an Android phone or an iOS iPhone/iPad:
[[Image:SBC3003_0.jpg|link=|thumb|300px]]


[[Image:webservice_general_pctoandroid.png|700px|link=|alt=]]
===PhidgetSBC4===
The PhidgetSBC4 (SBC3003) has the Phidget Network Server built-in. Simply connect your Phidgets, power the device, and the Network Server starts automatically.


The WebService runs on a local network. It is relatively durable because it uses link local addressing, which - depending on your [[#Using The WebService|operating system]] and router settings - will often work in the absence of DHCP.  Link local addressing will often persist even when access to the global Internet fails or is not available.
This device supports both Ethernet and WiFi connections and provides a simple web interface to configure your Phidget Network Server. Additionally, you can connect USB Phidgets directly to this device and run application code on board. Check out the [{{SERVER}}/?prodid=969 product page] for more information.


==WebService on the Phidget Single Board Computer==
==Phidget Network Server Clients==
Client applications can run on any [[Operating_System_Support|supported operating system]] and can be written in any [[Programming_Resources|supported programming language]]. The client machine does '''not''' need to run a Phidget Network Server.


The Phidget Single Board Computer (SBC) can provide a compact, inexpensive way to easily run the WebService. It runs the WebService in the background automatically from the moment you turn it on, and allows you to read from and control all Phidgets attached to it:
==Learn More==
View our [[Network Server Guide|Phidget Network Server Guide]] for more in-depth information.


[[Image:webservice_general_sbctopc.png|500px|link=|alt=]]


This can allow for a compact, mobile-based system like this:
{{Flow_Navigation_Buttons|{{Flow Page Number|{{PAGENAME}} }} }}
 
[[Image:webservice_general_sbctoandroid.png|500px|link=|alt=]]
 
The SBC runs Linux, which provides a [[OS - Phidget SBC|full operating system]] on which to develop code, [[Web Page on the SBC|serve web pages]], and [[Use Phidgets Wirelessly with the SBC|control Phidgets]].
 
==Using The Network Service==
 
Each Operating System page has a section on how to use the Network Service on that operating system:
 
* [[OS - Windows#Phidget Network Service|Windows]]
* [[OS - OS X#Phidget Network Service|Mac OS]]
* [[OS - Linux#Phidget Network Service|Linux]]
* [[OS - Phidget SBC#Phidget Network Service|Linux on the Phidget SBC]]
* [[OS - iOS#Phidget Network Service|iPhone/iPad iOS]]
 
The operating systems pages have complete examples on how to set up a network service process and using it to remotely control or gather data from Phidgets. The pages also tell you how to start and stop the Network Service 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 Service:
 
=== C/C++ ===
 
<syntaxhighlight lang=cpp>
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);
</syntaxhighlight>
 
=== C# ===
 
=== Java ===
 
=== Python ===
 
== Troubleshooting ==
 
When using the Network Service, both the '''client and server should have the ''same version''''' of the Network Service 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 [[General_Troubleshooting#Network_Service_Troubleshooting|Network Service section]].

Latest revision as of 19:47, 20 January 2025

 Phidget Programming Basics: Phidget Network ServerTOC Icon.png Table of Contents

Nav Back Arrow.png Nav Back Hover.png WhiteTab1.png HoverTab1.jpg WhiteTab2.png HoverTab2.jpg WhiteTab3.png HoverTab3.jpg WhiteTab4.png HoverTab4.jpg WhiteTab5.png HoverTab5.jpg WhiteTab6.png HoverTab6.jpg WhiteTab7.png HoverTab7.jpg WhiteTab8.png HoverTab8.jpg WhiteTab9.png HoverTab9.jpg WhiteTab10.png HoverTab10.jpg WhiteTab11.png HoverTab11.jpg WhiteTab12.png HoverTab12.jpg WhiteTab13.png HoverTab13.jpg WhiteTab14.png HoverTab14.jpg GreenTab15.png WhiteTab16.png HoverTab16.jpg Nav Next Arrow.png Nav Next Hover.png


15 . Phidget Network Server

What Is the Phidget Network Server?

The Phidget Network Server is a tool that makes it easy to access Phidgets that are connected to other computers on your network.

It also enables in-browser JavaScript applications with Phidgets, and provides a dictionary manager which can be used to share information between applications.

Without the Phidget Network Server

Your application runs on the same computer that your Phidgets are connected to.

Networkserver ex1v2.png

With the Phidget Network Server

Your Phidgets are connected to a computer running the Phidget Network Server. The Phidget Network Server hosts a Phidget Server, which makes your Phidgets available to other computers on your network.

  • Your application(s) can run on any computer that has access to the network the host is on.
  • Multiple applications can access the Phidgets simultaneously, with some exceptions (e.g. motor controllers).
Networkserver ex2v3.png

Phidget Network Server Hosts

As mentioned above, a computer is required to host the Phidget Network Server. Any Windows, macOS, or Linux machine can act as a host. The Wireless VINT Hub or the PhidgetSBC4 are also excellent, compact choices.

HUB5000 0.jpg

Wireless VINT Hub

The Wireless VINT Hub (HUB5000) has the Phidget Network Server built-in. Simply connect your Phidgets, power the device, and the Network Server starts automatically.

This device supports both Ethernet and WiFi connections and provides a simple web interface to configure your Phidget Network Server. Check out the product page for more information.

SBC3003 0.jpg

PhidgetSBC4

The PhidgetSBC4 (SBC3003) has the Phidget Network Server built-in. Simply connect your Phidgets, power the device, and the Network Server starts automatically.

This device supports both Ethernet and WiFi connections and provides a simple web interface to configure your Phidget Network Server. Additionally, you can connect USB Phidgets directly to this device and run application code on board. Check out the product page for more information.

Phidget Network Server Clients

Client applications can run on any supported operating system and can be written in any supported programming language. The client machine does not need to run a Phidget Network Server.

Learn More

View our Phidget Network Server Guide for more in-depth information.