Skip to content

Commit ce86af3

Browse files
committed
EthernetServer - added begin(port) and ctor without parameters
1 parent 39103da commit ce86af3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,11 +884,12 @@ Tells the server to begin listening for incoming connections.
884884

885885
```
886886
server.begin()
887+
server.begin(port)
887888
888889
```
889890

890891
#### Parameters
891-
None
892+
- port (optional): the port to listen on (int)
892893

893894
#### Returns
894895
None

src/Ethernet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,12 @@ class EthernetServer : public Server {
255255
private:
256256
uint16_t _port;
257257
public:
258+
EthernetServer() : _port(80) { }
258259
EthernetServer(uint16_t port) : _port(port) { }
259260
EthernetClient available();
260261
EthernetClient accept();
261262
virtual void begin();
263+
void begin(uint16_t port) {_port = port; begin();}
262264
virtual size_t write(uint8_t);
263265
virtual size_t write(const uint8_t *buf, size_t size);
264266
virtual operator bool();

0 commit comments

Comments
 (0)