Template:NetworkServerConfig: Difference between revisions
From Phidgets Support
(Created page with "==Configuring the Phidget Network Server== There are two different ways to configure the Phidget Network Server: *via the Phidget Control Panel (for Windows and macOS users)....") |
No edit summary |
||
(15 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
There are two different ways to configure the Phidget Network Server: | There are two different ways to configure the Phidget Network Server: | ||
*via the Phidget Control Panel (for Windows and macOS users). This provides a simple way for you to make changes to the Phidget Network Server, however, not all settings are available. | *via the Phidget Control Panel (for Windows and macOS users). This provides a simple way for you to make changes to the Phidget Network Server, however, not all settings are available. | ||
*modifying the Phidget Network Server configuration file directly | *modifying the Phidget Network Server configuration file directly. | ||
Find the configuration file on your machine by referencing the following table: | Find the configuration file on your machine by referencing the following table: | ||
{| class ="wikitable" style="text-align: center" | {| class ="wikitable" style="text-align: center" | ||
| align="center" style="background:#f0f0f0;"|'''Operating System''' | | align="center" style="background:#f0f0f0;"|'''Operating System''' | ||
| align="center" style="background:#f0f0f0;"|'''Location''' | | align="center" style="background:#f0f0f0;"|'''Location''' | ||
| align="center" style="background:#f0f0f0;"|'''File''' | |||
|- | |- | ||
|Linux||/etc/phidgets/ | |Linux||/etc/phidgets/||phidget22networkserver.pc | ||
|- | |- | ||
|Windows||C:/ProgramData/Phidgets | |Windows||C:/ProgramData/Phidgets||phidget22networkserver.pc | ||
|- | |- | ||
|macOS||/Library/Preferences/Phidget22NetworkServer/ | |macOS||/Library/Preferences/Phidget22NetworkServer/||phidget22networkserver.pc | ||
|- | |- | ||
|} | |} | ||
Line 21: | Line 22: | ||
===Settings=== | ===Settings=== | ||
{| | {| | ||
|style="width: | |style="width:62%"|<syntaxhighlight lang=bash> | ||
phidget{ | phidget{ | ||
enabled: true | enabled: true | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| | | | ||
{|class="wikitable" | |||
!colspan="2"|phidget { | |||
|- | |||
|enabled||enable the Phidget Server and provide access to Phidget channels over the network. | |||
|} | |||
|} | |} | ||
{| | {| | ||
|style="width: | |style="width:62%"|<syntaxhighlight lang=bash> | ||
phidget{ | phidget{ | ||
auth { | auth { | ||
Line 38: | Line 44: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| | | | ||
{|class="wikitable" | |||
!colspan="2"|auth { | |||
|- | |||
|password||set a password for your Phidget Server. | |||
|} | |||
|} | |} | ||
{| | {| | ||
|style="width: | |style="width:62%"|<syntaxhighlight lang=bash> | ||
phidget{ | phidget{ | ||
pidfile: '/var/run/phidget22networkserver.pid' | pidfile: '/var/run/phidget22networkserver.pid' | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| | | | ||
{|class="wikitable" | |||
!colspan="2"|phidget { | |||
|- | |||
|pidfile||where the UNIX pid file is written | |||
|} | |||
|} | |} | ||
{| | {| | ||
|style="width: | |style="width:62%"|<syntaxhighlight lang=bash> | ||
phidget{ | |||
logging { | logging { | ||
level: info | level: info | ||
Line 84: | Line 100: | ||
} | } | ||
} | } | ||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| | | | ||
The use of '''level''' throughout this section refers to log level. See the Phidget Control Panel [[Phidget Control Panel#Logging|logging section]] for more information. | |||
{|class="wikitable" | |||
!colspan="2"|logging { | |||
|- | |||
|file||choose the log file location and name | |||
|- | |||
|maxfiles||the maximum number of log files to keep before rotation deletes them. | |||
|- | |||
|maxsize||the maximum file size of a log file before rotation. | |||
|- | |||
!colspan="2"|network { | |||
|- | |||
|enabled||enable network logging. | |||
|- | |||
|port||tcp port that the server listens on | |||
|} | |||
|} | |||
{| | |||
|style="width:62%"|<syntaxhighlight lang=bash> | |||
phidget{ | |||
network { | |||
keepalive: 30000 | |||
ipv4 { | |||
address: localhost | |||
port: 5661 | |||
} | |||
datagram { | |||
enabled: true | |||
} | |||
publish { | |||
enabled: true | |||
name: 'Phidget22 Server' | |||
} | |||
resolveaddrs: false | |||
} | |||
} | |||
</syntaxhighlight> | |||
| | |||
{|class="wikitable" | |||
!colspan="2"|network { | |||
|- | |||
|keepalive||the server is constantly sending keepalive packets to the client, if it doesn't get a response in the ''keepalive'' milliseconds, it will close the connection (0 turns off, so server won't send keep alive) | |||
|- | |||
|resolveaddrs||if addresses should be resolved to names (affects performance) | |||
|- | |||
!colspan="2"|ipv4 { | |||
|- | |||
|address||the address to bind | |||
|- | |||
|port||server port | |||
|- | |||
!colspan="2"|datagram { | |||
|- | |||
|enabled||if UDP for events is allowed | |||
|- | |||
!colspan="2"|publish { | |||
|- | |||
|enabled||publish your Phidget Network Server to mDNS | |||
|- | |||
|name||the name that will be published (defaults to computer name). | |||
|} | |||
|} | |||
{| | |||
|style="width:62%"|<syntaxhighlight lang=bash> | |||
phidget{ | |||
feature { | |||
control { | |||
enabled: true | |||
} | |||
stats { | |||
enabled: true | |||
} | |||
dictionary { | |||
enabled: true | |||
directory: '/etc/phidgets/dictionary.d' | |||
} | |||
} | |||
} | |||
</syntaxhighlight> | |||
| | |||
{|class="wikitable" | |||
!colspan="2"|control { | |||
|- | |||
|enabled|| enables controls dictionary, which is the network one | |||
|- | |||
!colspan="2"|stats { | |||
|- | |||
|enabled|| enables the stats dictionary | |||
|- | |||
!colspan="2"|dictionary{ | |||
|- | |||
|enabled|| this enables the use of dictionaries on your server | |||
|- | |||
|directory||points to the dictionary.d file | |||
|} | |||
|} | |||
{| | |||
|style="width:62%"|<syntaxhighlight lang=bash> | |||
phidget{ | |||
filter { | |||
enabled: true | |||
clients { | |||
default: allow | |||
allow { | |||
enabled: false | |||
verbose: false | |||
list: ['192.168.2.159', '192.168.3.120' ] | |||
} | |||
deny { | |||
enabled: false | |||
verbose: false | |||
list: ['192.168.2.158', '192.168.3.119' ] | |||
} | |||
} | |||
} | |||
} | |||
</syntaxhighlight> | |||
| | |||
{|class="wikitable" | |||
!colspan="2"|filter { | |||
|- | |||
|enabled||enable filter to limit what clients are allowed to connect | |||
|- | |||
!colspan="2"|clients { | |||
|- | |||
|defaults||choose between ''allow'' or ''deny''. Controls if the default is to allow or deny connections. | |||
|- | |||
!colspan="2"|allow { | |||
|- | |||
|enabled||if allow rules should be processed | |||
|- | |||
|verbose||if clients that are allowed to cause a log message | |||
|- | |||
|list||list of addresses to allow | |||
|- | |||
!colspan="2"|deny { | |||
|- | |||
|enabled||if deny rules should be processed | |||
|- | |||
|verbose||if clients that are denied cause a log message | |||
|- | |||
|list||list of addresses to deny | |||
|} | |||
|} | |||
{| | |||
|style="width:62%"|<syntaxhighlight lang=bash> | |||
phidget{ | |||
www { | |||
enabled: true | |||
serverhost: 'my-pc' | |||
docroot: '/var/phidgets/www' | |||
mimetypes: '/etc/phidgets/mimetypes.kv' | |||
logging { | |||
level: debug | |||
accesslog: '/var/log/phidget22access.log' | |||
} | |||
network { | |||
cachectrl: nocache | |||
ipv4 { | |||
address: 192.168.1.1 | |||
port: 8080 | |||
} | |||
publish { | |||
enabled: true | |||
name: 'Phidget22 Server' | |||
} | |||
} | |||
phidgets { | |||
enabled: true | |||
passwd: 'temp123' | |||
} | |||
} | |||
} | |||
</syntaxhighlight> | |||
| | |||
{|class="wikitable" | |||
!colspan="2"|www { | |||
|- | |||
|enabled||enables the Phidget Webserver | |||
|- | |||
|serverhost||the host name to use for redirects etc. This should not be specified unless there is a reason to override the host name (e.g. server being accessed through a firewall) | |||
|- | |||
|docroot||where your webpage/files exist. | |||
|- | |||
|mimetypes|| location of mimetypes file | |||
|- | |||
!colspan="2"|logging { | |||
|- | |||
|level||See the Phidget Control Panel [[Phidget Control Panel#Logging|logging section]] for more information about different log levels. | |||
|- | |||
|accesslog||specify the access log location. This file lets you know who has accessed your webserver. | |||
|- | |||
!colspan="2"|network { | |||
|- | |||
|cachectrl||prevents clients from caching results (for testing) | |||
|- | |||
!colspan="2"|ipv4 { | |||
|- | |||
|address||address to bind | |||
|- | |||
|port||specify your port | |||
|- | |||
!colspan="2"|publish { | |||
|- | |||
|enabled||if the WWW server should be published to mDNS | |||
|- | |||
|name||the name to publish (defaults to computer name) | |||
|- | |||
!colspan="2"|phidgets { | |||
|- | |||
|enabled||contorls if we allow websocket upgrades for Phidgets | |||
|- | |||
|passwd||the server password | |||
|} | |||
|} | |} |
Latest revision as of 19:47, 7 October 2020
Configuring the Phidget Network Server
There are two different ways to configure the Phidget Network Server:
- via the Phidget Control Panel (for Windows and macOS users). This provides a simple way for you to make changes to the Phidget Network Server, however, not all settings are available.
- modifying the Phidget Network Server configuration file directly.
Find the configuration file on your machine by referencing the following table:
Operating System | Location | File |
Linux | /etc/phidgets/ | phidget22networkserver.pc |
Windows | C:/ProgramData/Phidgets | phidget22networkserver.pc |
macOS | /Library/Preferences/Phidget22NetworkServer/ | phidget22networkserver.pc |
Now that you have the configuration file on hand, we will go through each setting and describe it.
Settings
phidget{
enabled: true
}
|
|
phidget{
auth {
password: 'temp123'
}
}
|
|
phidget{
pidfile: '/var/run/phidget22networkserver.pid'
}
|
|
phidget{
logging {
level: info
file: 'c:/tmp/networkserver.log'
maxfiles: 4
maxsize: 1048576
network {
enabled: true
port: 5771
}
source {
phidget22net {
level: info
}
_phidget22usb {
level: info
}
_phidget22match {
level: error
}
_phidget22channel {
level: error
}
_phidget22bridge {
level: error
}
_phidget22disp {
level: error
}
}
}
}
|
The use of level throughout this section refers to log level. See the Phidget Control Panel logging section for more information.
|
phidget{
network {
keepalive: 30000
ipv4 {
address: localhost
port: 5661
}
datagram {
enabled: true
}
publish {
enabled: true
name: 'Phidget22 Server'
}
resolveaddrs: false
}
}
|
|
phidget{
feature {
control {
enabled: true
}
stats {
enabled: true
}
dictionary {
enabled: true
directory: '/etc/phidgets/dictionary.d'
}
}
}
|
|
phidget{
filter {
enabled: true
clients {
default: allow
allow {
enabled: false
verbose: false
list: ['192.168.2.159', '192.168.3.120' ]
}
deny {
enabled: false
verbose: false
list: ['192.168.2.158', '192.168.3.119' ]
}
}
}
}
|
|
phidget{
www {
enabled: true
serverhost: 'my-pc'
docroot: '/var/phidgets/www'
mimetypes: '/etc/phidgets/mimetypes.kv'
logging {
level: debug
accesslog: '/var/log/phidget22access.log'
}
network {
cachectrl: nocache
ipv4 {
address: 192.168.1.1
port: 8080
}
publish {
enabled: true
name: 'Phidget22 Server'
}
}
phidgets {
enabled: true
passwd: 'temp123'
}
}
}
|
|