How to change the TCP ports MPF uses
Note
The functionality for changing the BCP port in the MPF-MC was added in MPF-MC v0.32.10.
Various MPF components talk to each other via a TCP socket protocol called BCP (which we invented). By default, MPF and MPF-MC each listen for incoming BCP connections on the following two TCP ports:
5050
MPF-MC5051
MPF
When MPF-MC starts up, it starts listening on port 5050. If the MPF game engine doesn't connect, MPF-MC will sit there and wait for it. No problem.
When the MPF game engine starts, it attempts to connect to the MC on port 5050. If it can't make a connection, it will try again, and keep trying until a connection is made. (Note that you can control the behavior of this in the config files.)
The MPF game engine also listens for incoming BCP connections on 5051. This is not used by MPF-MC, but is used by other things that need to connect to MPF, such as the MPF Monitor.
If you have a port conflict (because something else on your system is using port 5050 or 5051), then you can change the MPF and MPF-MC ports to whatever you want. Just add the following two sections to your machine-wide config file. Note that you have to change it in two places, the "bcp" section which is what the MPF game engine reads to know what port the MC is listening on, and the "mpf-mc" section which is what the MC reads to know what port it should listen on.
Valid port numbers are anything between 1024 and 65535.
# config_version=5
bcp:
connections:
local_display:
port: 1234
mpf-mc:
bcp_port: 1234
Something missing or wrong? You can fix it!
This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?
Please help us! You can fix it yourself and be an official "open source" contributor!
It's easy! See our Beginner's guide to editing the docs.
Page navigation via the keyboard: < >
You can navigate this site via the keyboard. There are two modes:
General navigation, when search is not focused:
- F , S , / : open search dialog
- P , , : go to previous page
- N , . : go to next page
While using the search function:
- Down , Up : select next / previous result
- Esc , Tab : close search
- Enter : go to highlighted page in the results