Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

Proposed changes

This PR exposes the UDP client sockets in UdpPubSubConnection to allow users to configure socket settings such as ReceiveBuffer size. Users can now access the underlying UDP clients through two new public read-only properties.

Implementation Details

  • Added PublisherUdpClients property: Returns a read-only list of active UDP clients used for publishing
  • Added SubscriberUdpClients property: Returns a read-only list of active UDP clients used for subscribing
  • Both properties return IReadOnlyList<UdpClient> using AsReadOnly() to ensure true immutability
  • Thread-safe access implemented with lock statements
  • Comprehensive tests added to validate functionality

Usage Example

var connection = new UdpPubSubConnection(...);
connection.Start();

foreach (var client in connection.PublisherUdpClients)
{
    // Configure socket settings
    client.Client.ReceiveBufferSize = 8192;
}

Related Issues

Types of changes

What types of changes does your code introduce?

  • Bugfix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Test enhancement (non-breaking change to increase test coverage)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, requires version increase of Nuget packages)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc.
  • I have signed the CLA.
  • I ran tests locally with my changes, all passed.
  • I fixed all failing tests in the CI pipelines.
  • I fixed all introduced issues with CodeQL and LGTM.
  • I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added necessary documentation (if appropriate).
  • Any dependent changes have been merged and published in downstream modules.

Further comments

The implementation follows the existing patterns in the codebase and provides safe, read-only access to the UDP clients while maintaining thread safety. The returned collections cannot be modified externally, but the underlying UdpClient objects and their Socket properties can be accessed for configuration purposes.

Original prompt

This section details on the original issue you should resolve

<issue_title>Make Network Socket in UdpPubSubConnection reachable</issue_title>
<issue_description>### Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

At the moment when using an UdpPubSubConnection one is not able to configure the used Socket. However one might want to adjust some settings of it and change them (e.g. the size of the ReceiveBuffer.

Expected Behavior

It should be possible to access the Socket of an UdpPubSubConnection

Steps To Reproduce

No response

Environment

No response

Anything else?

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

@mregen @mrsuciu, is the socket exposed by the MQTTNet client library?

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@romanett
Copy link
Contributor

romanett commented Dec 3, 2025

@copilot Please continue work

Copilot AI and others added 5 commits December 3, 2025 18:04
…tion

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
…ng wrapper

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
…ification

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 3, 2025

@copilot Please continue work

I've completed the implementation. The UdpPubSubConnection now exposes PublisherUdpClients and SubscriberUdpClients properties that return read-only lists of UDP clients, allowing users to configure socket settings like ReceiveBuffer size. The changes include comprehensive tests and follow the coding standards. See commit 506a461.

Copilot AI changed the title [WIP] Make Network Socket in UdpPubSubConnection reachable Make Network Socket in UdpPubSubConnection reachable Dec 3, 2025
@marcschier marcschier marked this pull request as ready for review December 3, 2025 19:52
@marcschier marcschier merged commit 226dd78 into master Dec 4, 2025
157 of 186 checks passed
@romanett romanett deleted the copilot/enhance-udp-pubsub-connection branch December 4, 2025 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Network Socket in UdpPubSubConnection reachable

4 participants