Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SocketWrapper - MbedServer modernization (without available() and Print)#793

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pennam merged 1 commit intoarduino:mainfromJAndrassy:mbedserver_modernization
Oct 3, 2024

Conversation

@JAndrassy
Copy link
Contributor

@JAndrassyJAndrassy commentedDec 6, 2023
edited
Loading

MbedServer didn't manage clients for proper available() and print-to-all-clients. Now available() in derived server classes WiFiClient and EthernetClient is deprecated and accept() is added with the same implementation. Inheriting from Print (Server) is removed.write methods for Print implementation are removed. They never worked.

New are constructor without parameters, begin with parameter port and end() as in the new WiFiS3 library.

The ChatServer examples never worked because they relay on Processing style server.available() and print-to-all-clients.. Removed.

ESP32 core and RP2040 core libraries too don't implement Processing style Servers. Processing style WiFiServer and EthernetServer for these cores and Mbed core is implemented in my NetAPIHelpers library. In my networking libraries WiFiEspAT and EthenetENC the print-to-all-clients is in separate class and in next major version I plan to remove server.available() and point to NetAPIHelpers Server.

This replaces PR#750 and#751

overview of Server implementations in librarieshttps://github.com/JAndrassy/Arduino-Networking-API/blob/main/ArduinoNetAPILibs.md#server-class

MbedServer didn't manage clients for proper available() andprint-to-all-clients. Now available() in derived server classes isdeprecated and accept() is added with the same implementation.Inheriting from Print (Server) is removed. write methods for Printimplementation are removed. They never worked.New are constructor without parameters, begin with parameter port andoperator bool.
@JAndrassy
Copy link
ContributorAuthor

JAndrassy commentedFeb 5, 2024
edited
Loading

@facchinm@pennam

now this is my last essential PR for Mbed Core networking. It does changes proposed by Alessandro Ranellucci, but including the consequences

#750 adds accept() in WiFiServer

consequences:

  • add accept in EthernetServer
  • deprecateavailable
  • modify examples to use accept() and remove Ethernet examples which require true server.available() (WiFi lib doesn't have them)
  • remove unimplementedPrint inheritance andwrite methods, because print-to-all-clients is tied withserver.available()

#751 adds end() in WiFiServer

consequences:

  • add end() in EthernetServer

other related server classes modernization as in WiFiS3:

  • addbegin with parameterport and constructor without parameters
  • add operator bool

Some context:

The server.available()originates in Processing. It is an idea to simplify a TCP server for artists. But as the lack of proper server.available() here and in multiple third party libraries shows, users not expect that behavior. In most request-response-stop use-cases it doesn't even matter.

Class Server inherits from Print for the print-to-all-clients functionality. This functionality is tied with the available() method implementation. The implementation of the Server class should register all connected clients for correct implementation of available() and for print-to-all-clients functionality.

The base class Server can't declare required server methods available() and accept(), because they have the return type of the specific Client implementation of the library (for example EthernetClient in the Ethernet library). As a consequence, It is not possible to use the base class Server to work with an instance of an inherited server class. So Server is just disguised Print and without Print usage inheriting from Server class is useless.

Copy link
Contributor

@pennampennam left a comment
edited
Loading

Choose a reason for hiding this comment

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

@JAndrassy
Copy link
ContributorAuthor

JAndrassy commentedOct 3, 2024
edited
Loading

it is just a comment which is not true. it is same in the Ethernet library from where the example originates.
I guess it had Serial.write in " // check for incoming data from all clients" section at some point in time.

arduino-libraries/Ethernet@2304c69

pennam reacted with thumbs up emoji

@pennampennam merged commit4726f25 intoarduino:mainOct 3, 2024
@JAndrassyJAndrassy deleted the mbedserver_modernization branchOctober 3, 2024 12:57
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@pennampennampennam left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@JAndrassy@pennam

[8]ページ先頭

©2009-2025 Movatter.jp