-
Notifications
You must be signed in to change notification settings - Fork 29
Possibility to change the default port 6454 to another if necessary #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis pull request refactors how network ports are handled in both the StupidArtnet client and server classes. The class-level constant Changes
Sequence Diagram(s)sequenceDiagram
participant User as Client/User
participant Artnet as StupidArtnet
participant Sock as Socket
User->>Artnet: Instantiate with port (default=6454)
Artnet->>Sock: Initialize socket using self.port
Artnet->>Artnet: Use self.port in __str__, send_artsync, and show
sequenceDiagram
participant Admin as Server Admin
participant Server as StupidArtnetServer
participant Sock as Socket
Admin->>Server: Instantiate with port (default=6454)
Server->>Sock: Bind socket using self.port
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
stupidArtnet/StupidArtnetServer.py (2)
223-224
: Consider adding port validation.While the implementation is correct, there's no validation to ensure the port value is within the valid range (1-65535).
def __init__(self, port=6454): """Initializes Art-Net server.""" + if not 1 <= port <= 65535: + raise ValueError(f"Port must be between 1 and 65535, got {port}") self.port = port # Use provided port or default # server active flag self.listen = True
223-224
: Update the test example with the port parameter.The test code at the bottom of the file doesn't demonstrate how to use the new port parameter.
# Initilize server, this starts a server in the Art-Net port -a = StupidArtnetServer() +# Using default port 6454 +a = StupidArtnetServer() + +# Or using a custom port +# custom_port = 7000 +# a = StupidArtnetServer(port=custom_port)stupidArtnet/StupidArtnet.py (2)
375-375
: Update the example usage with the port parameter.The example usage at the bottom of the file doesn't demonstrate how to use the new port parameter.
-a = StupidArtnet(TARGET_IP, UNIVERSE_TO_SEND, PACKET_SIZE, artsync=True) +# Using default port 6454 +a = StupidArtnet(TARGET_IP, UNIVERSE_TO_SEND, PACKET_SIZE, artsync=True) + +# Or using a custom port +# custom_port = 7000 +# a = StupidArtnet(TARGET_IP, UNIVERSE_TO_SEND, PACKET_SIZE, artsync=True, port=custom_port)
21-21
: Consider adding port validation.While the implementation is correct, there's no validation to ensure the port value is within the valid range (1-65535).
def __init__(self, target_ip='127.0.0.1', universe=0, packet_size=512, fps=30, even_packet_size=True, broadcast=False, source_address=None, artsync=False, port=6454): """Initializes Art-Net Client. + if not 1 <= port <= 65535: + raise ValueError(f"Port must be between 1 and 65535, got {port}")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
stupidArtnet/StupidArtnet.py
(6 hunks)stupidArtnet/StupidArtnetServer.py
(2 hunks)
🔇 Additional comments (9)
stupidArtnet/StupidArtnetServer.py (2)
24-26
: Function signature and property initialization look good.The addition of an optional port parameter with default value 6454 is a good approach that maintains backward compatibility while offering flexibility for users who need to use alternative ports.
38-38
: Socket binding updated correctly.The socket binding now uses the instance-specific port value which aligns with the constructor changes.
stupidArtnet/StupidArtnet.py (7)
21-21
: Function signature updated correctly.The addition of the port parameter to the constructor with a default value of 6454 maintains backward compatibility.
32-32
: Parameter documentation added.Documentation for the new port parameter is properly added to the docstring.
49-49
: Property initialization looks good.The port property is properly initialized with the provided parameter value.
89-89
: String representation updated correctly.The string representation now uses the instance-specific port property.
166-166
: Network operation updated correctly.The
send_artsync
method now uses the instance-specific port value which aligns with the constructor changes.
177-177
: Network operation updated correctly.The
show
method now uses the instance-specific port value which aligns with the constructor changes.
21-33
:❓ Verification inconclusive
Verify that this works with existing Art-Net devices.
While the implementation allows for flexibility, it's important to verify that custom ports actually work with standard Art-Net equipment, as some might be hardcoded to only use port 6454.
Consider verifying this implementation against Art-Net specifications or testing with actual devices. You may also want to add a documentation note that standard Art-Net devices typically operate on port 6454, and changing this value may limit compatibility with certain hardware.
🌐 Web query:
Does Art-Net protocol allow using ports other than 6454?
💡 Result:
The Art-Net protocol primarily uses UDP port 6454 as its default for communication[1][3][5][6][8][12][16][18]. However, flexibility exists in some implementations:
Key Findings:
Default Port:
Art-Net's standard port is 6454 (hex0x1936
), widely adopted across controllers, nodes, and software (e.g., QLC+, ETC Eos, Tasmota)[1][2][6][12].Configurability:
- Software Flexibility: Certain software tools like QLC+ and Lightjams allow users to override the default port in configuration settings[6][18]. For example, QLC+ enables custom port selection for Art-Net outputs via its plugin interface[6][8].
- Unicast/Broadcast Modes: While the protocol itself specifies port 6454, network configurations (e.g., directed broadcast addresses like
2.255.255.255
or10.255.255.255
) can influence packet routing without altering the port[1][5][10].Hardware Limitations:
Many Art-Net nodes and devices expect data on port 6454 by default. Deviating from this may require explicit configuration on both transmitter and receiver ends[11][16]. For instance, TouchDesigner users encountered issues until forcing the port to 6454 via workarounds[16].Protocol Specifications:
Art-Net 3/4 documentation does not explicitly restrict port usage, implying the port is implementation-dependent. However, adherence to port 6454 ensures compatibility across devices[1][5][10][15].Summary Table:
Aspect Details Default Port 6454 (UDP) Configurable Yes (in some software, e.g., QLC+, Lightjams)[6][18] Node Compatibility Most devices expect port 6454 unless reconfigured[11][16] Protocol Support Port flexibility depends on implementation, not protocol restrictions[5][10] In practice, while the default port is strongly recommended for interoperability, some software implementations permit alternative ports, provided all network components (controllers, nodes) are reconfigured accordingly.
Citations:
- 1: https://www.chauvetprofessional.com/wp-content/uploads/2015/06/Art-Net-3-Instructions.pdf
- 2: https://support.etcconnect.com/ETC/Consoles/Eos_Family/Software_and_Programming/ArtNet_Configuration_in_Eos_Software
- 3: https://forum.arduino.cc/t/artnet-to-dmx-project-memory-issues/94061
- 4: http://filedownload.chromateq.com/Tutorials/ArtNet%20protocol%20configuration.pdf
- 5: https://art-net.org.uk/downloads/art-net.pdf
- 6: https://www.qlcplus.org/old/docs/html_en_EN/artnetplugin.html
- 7: https://www.etcconnect.com/webdocs/Controls/HOG/HTML/en/sect-ww_art_net.htm
- 8: https://docs.qlcplus.org/v4/plugins/art-net
- 9: https://groups.google.com/g/qlab/c/5N5OdoEItzc
- 10: https://art-net.org.uk/background/
- 11: https://forum.mikrotik.com/viewtopic.php?t=144623
- 12: https://tasmota.github.io/docs/ArtNet/
- 13: https://www.chromateq.com/all-about-art-net/
- 14: https://community.blynk.cc/t/artnet-protocol-blynk-controller/3771
- 15: https://en.wikipedia.org/wiki/Art-Net
- 16: https://forum.derivative.ca/t/solved-dmx-out-artnet-source-network-port/10071
- 17: https://art-net.org.uk/port/
- 18: https://www.lightjams.com/artnet.html
- 19: https://interactive-online.com/manuals/cs2/art-net-protocol
- 20: https://files.support.epson.com/docid/cpd5/cpd59747/source/network/reference/plebl250f_l255f/artnet_channel_definitions_plebl250f_l255f.html
Action: Confirm compatibility of custom port support with Art-Net devices
The code sets the port to 6454 by default, which is the recommended standard. However, as your implementation allows overriding the port, keep in mind that many Art-Net devices are configured to use port 6454. Please verify with your target hardware that non-default port configurations still work reliably. Additionally, consider updating the documentation to note that while custom ports are supported in some software, deviating from the default may limit interoperability with devices expecting port 6454.
- The code snippet correctly defaults to port 6454.
- Web references confirm that most Art-Net devices expect port 6454, although configurable alternatives exist.
- It is advisable to test any non-default configurations and update the documentation accordingly.
…36) * Modify UDP port * added annotation and updated example
Hi,
I added the ability to change the port (which remains 6454 by default) to something else on the server and the client.
I was able to test it on the client and it works well, but I haven't tested the server yet.
Summary by CodeRabbit