Skip to content

Commit 6b80abe

Browse files
author
shennongmin
committed
Add API:startServer and stopServer
Signed-off-by: shennongmin <[email protected]>
1 parent 8e63790 commit 6b80abe

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

ESP8266.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,16 @@ bool ESP8266::stopTCPServer(void)
248248
return false;
249249
}
250250

251+
bool ESP8266::startServer(uint32_t port)
252+
{
253+
return startTCPServer(port);
254+
}
255+
256+
bool ESP8266::stopServer(void)
257+
{
258+
return stopTCPServer();
259+
}
260+
251261
bool ESP8266::send(const uint8_t *buffer, uint32_t len)
252262
{
253263
return sATCIPSENDSingle(buffer, len);

ESP8266.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,26 @@ class ESP8266 {
306306
* @retval false - failure.
307307
*/
308308
bool stopTCPServer(void);
309+
310+
/**
311+
* Start Server(Only in multiple mode).
312+
*
313+
* @param port - the port number to listen(default: 333).
314+
* @retval true - success.
315+
* @retval false - failure.
316+
*
317+
* @see String getIPStatus(void);
318+
* @see uint32_t recv(uint8_t *coming_mux_id, uint8_t *buffer, uint32_t len, uint32_t timeout);
319+
*/
320+
bool startServer(uint32_t port = 333);
321+
322+
/**
323+
* Stop Server(Only in multiple mode).
324+
*
325+
* @retval true - success.
326+
* @retval false - failure.
327+
*/
328+
bool stopServer(void);
309329

310330
/**
311331
* Send data based on TCP or UDP builded already in single mode.

0 commit comments

Comments
 (0)