Skip to content

Conversation

@martin-kuhn
Copy link
Contributor

Description

The socket struct has two fields for endpoints, a local and a remote endpoint. These files have always been Null, so the get request to these fields always returned Null. This makes it impossible to use methods like SendTo() and ReceiveFrom().

Motivation and Context

Nevertheless, the send() and receive() methods worked correctly. But sometimes it is necessary to determine the IP and port address of a connected device.
The problem was that there were two endpoints defined and initialized with Null in the GetEndPoint() method. Only one of them got updated but then the other one was used as return value. I removed the first one and adjusted the return value.

How Has This Been Tested?

This has been tested with a custom STM32F427 based MCU board with network interface. Both client and server modes have been used as test applications.

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Signed-off-by: Martin Kuhn martin.kuhn@csa.ch

@nfbot
Copy link
Member

nfbot commented Jan 13, 2020

Hi @martin-kuhn,

I'm nanoFramework bot.
Thank you for your contribution!

A human will be reviewing it shortly. 😉

Copy link
Member

@josesimoes josesimoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look OK.

On the original implementation (from .NETMF) the call to getsockname had the address parameter with the socket address. This has been improved to be of type EndPoint, but the code of GetEndPoint() was never updated accordingly.

Nice catch! 👍

@claassistantio
Copy link

claassistantio commented Jan 13, 2020

CLA assistant check
All committers have signed the CLA.

@josesimoes josesimoes added the Type: bug Something isn't working label Jan 13, 2020
@josesimoes
Copy link
Member

@martin-kuhn please sign the CLA

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@josesimoes josesimoes changed the title fix return value of GetEndpoint() Fix return value of GetEndpoint() Jan 13, 2020
@josesimoes josesimoes merged commit 645bf95 into nanoframework:develop Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants