Skip to content

Add possibility to change server tcp port in void setup. No more fixed port! #5062

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

Closed
wants to merge 6 commits into from

Conversation

5a2v0
Copy link

@5a2v0 5a2v0 commented Jun 22, 2016

Before this mofication:

EthernetServer server(80);
void setup() {
//some stuff here
server.begin(); //User can't change initial port value
//other stuff here
}

Now:

EthernetServer server; //without port declaration but still working old declaration system...
void setup() {
//some stuff here
unsigned int tcp = EEPROM.read(x)
server.begin(tcp); //User can now use a different port, maybe saved in eprom directly from the sketch in a configuration page that permise to choice a value for the tcp port...
//other stuff here
}

Many thanks to Arduino's forum user: SukkoPera

5a2v0 added 6 commits June 22, 2016 16:20
I edited the line:
EthernetServer(uint16_t);
in
EthernetServer();
and I added;
virtual void begin(uint16_t);
So user can choose in his sketch to use "server.begin();" without parameters and the library will use tcp port 80 as default, or user can use "server.begin(int);" and the webserver will start using the tcp port indicated in the sketch (for example the tcp port can be stored in eprom. At board's startup, it can read the value and use it, while before user must declare a fixed tcp port).
I removed from the line:
EthernetServer::EthernetServer() {}
the "uint16_t port" declaration
and then the "_port = port;" that I wrote into the modified begin constructor:
So ".begin();" become ".begin(int);".
If user don't declare nothing and use the previous method, library will use standard tpc port 80 with:

void EthernetServer::begin() {begin(80); }

Many thanks to Arduino's forum user: SukkoPera
@sandeepmistry
Copy link
Contributor

Hi @5a2v0,

Thank you for submitting this change. Could you please resubmit a pull request to this repo: https://github.com/arduino-libraries/Ethernet

Then close this pull request. The libraries/Ethernet folder is synced with the other repo. I have linked to.

@sandeepmistry sandeepmistry added Waiting for feedback More information must be provided before we can proceed Library: Ethernet The Ethernet Arduino library labels Jul 12, 2016
@agdl
Copy link
Member

agdl commented Jul 12, 2016

This issue was moved to arduino-libraries/Ethernet#32

@agdl agdl closed this Jul 12, 2016
@agdl
Copy link
Member

agdl commented Jul 12, 2016

Sorry closed by mistake

@agdl agdl reopened this Jul 12, 2016
@5a2v0
Copy link
Author

5a2v0 commented Jul 14, 2016

Thanks for moving to the right place!

@q2dg
Copy link

q2dg commented Jul 28, 2016

Ei, the issue has been moved but the pull request hasn't

@sandeepmistry
Copy link
Contributor

This has been moved to arduino-libraries/Ethernet#39 by @5a2v0, so closing.

Copy link

@MrPiNkY2022 MrPiNkY2022 left a comment

Choose a reason for hiding this comment

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

Allow merge

@5a2v0
Copy link
Author

5a2v0 commented Sep 14, 2022

Allow merge

Ok, so can I delete my fork?

@per1234
Copy link
Collaborator

per1234 commented Sep 14, 2022

Hi @5a2v0. First of all, I should make it clear that @MrPiNkY2022 does not represent Arduino. Any GitHub user may review any pull request on any public repository. I don't know why they thought it would be appropriate to review a closed PR.

Now, to answer your question: yes, you are welcome to delete your fork of this repository:

https://github.com/5a2v0/Arduino

That fork is no longer needed since this pull request is closed.

However, it would be better if you did not delete your fork of the Ethernet library repository:

https://github.com/5a2v0/Ethernet

The reason is that your pull request in that repository (arduino-libraries/Ethernet#39) is still open. If you delete your fork of the Ethernet library and a maintainer of the Ethernet repository requests changes to that pull request, it will not be possible to make the requested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Library: Ethernet The Ethernet Arduino library Waiting for feedback More information must be provided before we can proceed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants