-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Conversation
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
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 |
This issue was moved to arduino-libraries/Ethernet#32 |
Sorry closed by mistake |
Thanks for moving to the right place! |
Ei, the issue has been moved but the pull request hasn't |
This has been moved to arduino-libraries/Ethernet#39 by @5a2v0, so closing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow merge
Ok, so can I delete my fork? |
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. |
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