[Solved] Multi-terminal / Message Server woes?

Since I put together the Kitchen Display Tutorial using Task Printer and Custom Entity Screen with Task Editor Widget, I finally went a got a small 10" tablet to use as a Kitchen Display. I was very excited to see it in action, but alas, I am having some issues.

This is my first foray into a multi-terminal setup, and I am looking for some guidance - particularly as it pertains to updating the Kitchen Display on the Client.

The first problem was getting connected to the server DB. I eventually managed to do this, but for some reason I cannot get it to work with Windows Firewall turned on, even with setting static port 1433 and opening ports in the Firewall. Oh well, I will deal with that later.

I had the same “issue” with getting the green Connected indicator for the Message Server on the Client, but again managed to overcome this by disabling the Firewall. I’ll deal with that later too.

Ok, so I am have the Client connected to the DB on the Server and the Message Server is running and the Client has a green Connected message. So far, so good, however…

I am not seeing updates on my Kitchen Display (client) when I submit an Order via the server. If I close and re-open the Entity Screen, the new Orders are there, but I would expect them to automatically refresh and update without interaction.

I have an Action in my Task Printer Rule that Broadcasts a Message. I also have a Rule to detect Message Received, and have an Action in that Rule to Update Widget. There is also a Show Message Action in there, but it does not appear. So I am lost…

I would expect, at the very least, that the Show Message Action would appear, but it does not. This indicates to me that the Message Service is not working properly, but I don’t really know what is going on here. Do I even need Message Server? Do I need to refresh the Entity Screen as well? If so, why? I assumed updating the Widget would do the trick.

Q let me dig it up but I have an article explaining how to setup the firewall to allow the service without having to mess with ports. This will allow SQL Server to run using dynamic ports even.

You installed the Message Server Service? Or are you using the client?

1 Like

I think I came across that in my searches, but I am not really worried about that aspect at this time.

I am using the Message Server Service (installed as a service) running on the server Terminal.

###Server

###Client

Hmm it should auto update… did you set unique terminal name for it and for the server via Settings > Local Settings > General

I see you have one for the kitchen terminal.

Yes, I have 2 Teminals: Server and HHKitchen

The server (running the DB and Message Service) is set in Local Settings as Server

The client is set in Local Settings as HHKitchen, and has the Message Client set to Auto-start). The Message Server Name on the client is set to the computer name of the server (JVSERVER). This is shown in the last screenshot in previous post

Did you try restarting SambaPOS on both machines? Mine just works no additional automation was needed. As far as I can tell you have set it up correctly.

Yes, restarted SambaPOS on both machines, even rebooted.

Even the basic Customer and Table Screens do not update. Tables don’t change color, Ticket Listers do not update…

On the server, I shut down SambaPOS and stopped the Message Service. The client still indicates it is connected (green Connected indicator at bottom left).

That can’t be right. I expect it to switch to Not Connected, but it does not. How can I trust the indicator now?

I just submitted an Order via the client, and TCPView went mad with retries to port 9898 (the port I configured for Message server), and finally the indicator went red and said Not Connected.

Fired up the Message Service, and see this…

###Client

###Server

So it appears from TCPView that messages are being sent from the Client and received by the Server, yet the server Entity Screens do not update.

If I submit an Order via the Server, I see no communication occurring via TCPView.

Do I need to start the client on the Server as well?

EDIT: Yes, that is it. The Message Client needs running on both the Server and the Client.

I guess that makes perfect sense. :stuck_out_tongue_winking_eye: Everything is working now! :smiley: And I just gotta say… man that is slick! Very cool. And fast, even on my WiFi (no interference or other users at home here though).

EDIT2: I was able to remove all automation regarding Broadcast Message, Message Received, and Widget/Screen Refreshes. It still works without any of that.

###Server

###Client


Now off to figure out how to get my Firewall back on…

1 Like

You can add the actual sqlserv exe and it will enable the service under the firewall.

Tried that and still no go…

For my testing, the server is running on Win 7 x64 and SQL Express 2014 x64.

The Client is running Win 8.1 32-bit.

Tests are being done via WiFi.

Strangely enough, from the Client, the UDL file connects without issue when I use SQL Native Client 10, but not when I use MS OLE for SQL). But SSMS (32-bit) and SambaPOS (32-bit) cannot connect unless I turn off the Firewall on the Server. The OLE Provider works fine then too.

Hmm… came across an article that says I need to open UDP 1434 for SQL Browser.

Removed SQLSERVR.exe from the program list, and re-enabled inbound Rule for TCP 1433 which I had set up before.

Added another inbound Rule to allow UDP 1434.

Seems to be working for DB connection.

Does my Message Server still work on 9898? EDIT: Yes, it appears to be working too.

So to recap…

##Server

On the Server, where SQL Express is installed, ensure these Services are running:

  • SQL Server
  • SQL Server Browser
  • SQL Server VSS Writer (not required for remote connections, but needed for DB Backup/Restore etc.)


Create Inbound Rules in Windows Firewall to allow access to required Protocols/Ports:

Control Panel > Windows Firewall > Advanced Settings > Inbound Rules > New Rule...

  • TCP 1433
  • UDP 1434
  • TCP (choose a Port for Messaging Service)

Inbound Rule for Messaging Service…


Using SQL Server Configuration Manager, enable TCP/IP connections under SQL Server Network Configuration > Protocols for [SQLEXPRESS], and set a Static TCP Port (1433) for the IP of the Server. Also, it is suggested to delete the 0 in the TCP Dynamic Ports field.


Run the Messaging Server Service Tool on the Server to install the Messaging Service as a Windows Service so that it starts when Windows starts. You can use it to update the Port you want to use as well.

C:\Program Files (x86)\SambaPOS5\Samba.MessagingServerServiceTool.exe

Check the SambaPOS MessagingServer Service Logon options and use an Administrator Account …


Ensure you have Terminals defined in SambaPOS for each Terminal (including the Server).

Manage > Settings > Terminals


Configure the Server to use the “Server” Terminal name, and set the Message Client to auto-start. Since this is the main Server, you can use the following for the Message Server Name:

Manage > Settings > Local Settings

  • name of the computer (i.e. http://SERVER-PC)
  • http://localhost (local loopback name)
  • IP address of the server computer (i.e http://192.168.0.200)
  • http://127.0.0.1 (local loopback IP address)


##Client

There are no special settings that need to be made in Windows for the Client Terminals. For example:

  • no need to mess with the Firewall
  • SQL Express does not need to be installed, so there are no services to check on (we will configure SambaPOS to connect to the database on the main Server Terminal)
  • Messaging Server Service should not be running or installed (no service to check)

Ensure your Local Settings are configured properly for this Terminal.

Manage > Settings > Local Settings

  • select the name that will be used for this Terminal (every terminal must use a unique name)
  • set the Connection String to connect to the Database on the Server
  • set the Message Client to auto-start, and set the Message Server Name to the IP address or Computer Name of the Server (ie. http://JVSERVER)

3 Likes

Can’t believe you’ve never felt with multiple terminals before :smile: nice to see even long time pros get stuck :-p
Thanks for the firewall details, have really struggled in the past and not really understood what I did to sort, this is book marked for next time :slight_smile:

@QMcKay HAHA yes it solved my isues too before msg server connects when you logon to sambapos now its connects automatically this helped me thanks bookmarked too. Now I need to work how the msg server works through network over internet as I can use pos but not msg server.

Msg server not meant to work over Internet.

@kendash Ok Thanks for the info but also those settings solved my long time firewall issue as I was only able to connect to client when firewall turned off but QMcKay screen shots solved my issue now I can connect even firewall on through port . thanks community.

1 Like

Found this Powershell Script. Should make things easier.

Copy/paste the script into Notepad (or similar) and save the file as: fw.ps1

function isFirewallPortOpen {
    param( [int] $port )
    $fw = New-Object -ComObject hnetcfg.fwpolicy2 
    if ($fw.Rules | Where {$_.LocalPorts -eq $port }) {
        return [bool]$true
    } else {
        return [bool]$false
    }
}

function existsFirewallRule {
    param( [string] $name )
    $fw = New-Object -ComObject hnetcfg.fwpolicy2 
    if ($fw.Rules | Where { $_.Name -eq $name }) {
        return [bool]$true
    } else {
        return [bool]$false
    }
}

function addFirewallRule {
    param(
        [string] $name,
        [int] $port,
        [int] $protocol
    )
    $fw = New-Object -ComObject hnetcfg.fwpolicy2 
    if (isFirewallPortOpen $port -or existsFirewallRule $name) {
        Write-Host -ForegroundColor:Red "**Rule Already Exists or Port Already Open."
    } else {
        $rule = New-Object -ComObject HNetCfg.FWRule

        $rule.Name = $name
        $rule.Protocol = $protocol
		# NET_FW_IP_PROTOCOL_TCP = 6
		# NET_FW_IP_PROTOCOL_UDP = 17
        $rule.LocalPorts = $port
        $rule.Enabled = $true
        #$rule.Grouping = "SambaPOS Multi-terminal"
        $rule.Profiles = 2
		# NET_FW_PROFILE2_DOMAIN   = 1
		# NET_FW_PROFILE2_PRIVATE  = 2
		# NET_FW_PROFILE2_PUBLIC   = 4
		# NET_FW_PROFILE2_ALL      = 7
        $rule.Action = 1 # NET_FW_ACTION_ALLOW
        $rule.EdgeTraversal = $false

        $fw.Rules.Add($rule)
        Write-Host -ForegroundColor:Blue "A rule named '$name' has been added to Windows' Firewall."
    }
}

addFirewallRule -name:"SambaPOS SQL Traffic" -port:1433 -protocol:6
addFirewallRule -name:"SambaPOS SQL Browser Traffic" -port:1434 -protocol:17
addFirewallRule -name:"SambaPOS Messaging Server" -port:9898 -protocol:6

The last 3 lines of the script execute to add 3 Inbound Rules to the Firewall. Change the name of the Rule or the port if desired.


Open a Command Prompt as Administrator and navigate to the location of the fw.ps1 file. In the Command Window, type the following to execute the script:

powershell -executionpolicy bypass -File fw.ps1

This screenshot shows what happens when it is successful, and what happens if it is run when the Rule or Protocol/Port already exist in the Firewall.

And here, we see 3 Rules have been created:

2 Likes

Hmm… @emre, what do I need to do to make Terminals aware that a Workperiod has been opened or closed?

My setup uses the Start Workperiod and End Workperiod Actions.

On the main server Terminal, when I start or end a WP, the clients are not aware of this change…

The Nav Screen POS Tile does not update to reflect {SETTING:ISCURRENTWORKPERIODOPEN}, and it’s operation (clicking on it) does not behave as expected.

For example, if the WP was open and I close it on the Server, I can still click on the POS button and start creating a Ticket.

Vice-versa, if the WP was closed and I open it on the Server, when I click on the POS button on the Client, it does not respond (it thinks the WP is still closed).

Thanks for reporting. It will work fine on next update (.56).

2 Likes