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

New Server base class ?#216

JAndrassy started this conversation inIdeas
Discussion options

What do you think about introducing a new base class for servers? One based on what is actually useful. It would be more a guide than a useful base class, but for Client and UDP the base classes do an excellent job for consistency of the networking API implementations.

template <class TClient>class ServerNew {  virtual void begin(uint16_t port) = 0;  virtual void end() = 0;  virtual explicit operator bool() = 0;  virtual TClient accept() = 0;};#define CORE_HAS_SERVERNEW

It doesn't require the confusingavailable method and the never used print-to-all-clients' functionality.
It has parameter port forbegin, it doesn't have to be in constructor.

The library authors could ifdef their server class declaration.

class EthernetServer #ifdef CORE_HAS_SERVERNEW   :  public ServerNew<EthernetClient>#endif{

or even

class EthernetServer :#ifdef CORE_HAS_SERVERNEW    public ServerNew<EthernetClient>,#endif    public Server{

would work

Here is an overview of Server implementation in libraries
https://github.com/JAndrassy/Arduino-Networking-API/blob/main/ArduinoNetAPILibs.md#server-class

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Ideas
Labels
None yet
1 participant
@JAndrassy

[8]ページ先頭

©2009-2025 Movatter.jp