MySensors Library & Examples
2.3.2-119-g6af75d19
hal
architecture
Linux
drivers
core
EthernetServer.h
1
/*
2
* The MySensors Arduino library handles the wireless radio link and protocol
3
* between your home built sensors/actuators and HA controller of choice.
4
* The sensors forms a self healing radio network with optional repeaters. Each
5
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
6
* network topology allowing messages to be routed to nodes.
7
*
8
* Created by Henrik Ekblad <
[email protected]
>
9
* Copyright (C) 2013-2026 Sensnology AB
10
* Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
11
*
12
* Documentation: http://www.mysensors.org
13
* Support Forum: http://forum.mysensors.org
14
*
15
* This program is free software; you can redistribute it and/or
16
* modify it under the terms of the GNU General Public License
17
* version 2 as published by the Free Software Foundation.
18
*
19
* Based on Arduino ethernet library, Copyright (c) 2010 Arduino LLC. All right reserved.
20
*/
21
22
#ifndef EthernetServer_h
23
#define EthernetServer_h
24
25
#include <list>
26
#include <vector>
27
#include "Server.h"
28
#include "IPAddress.h"
29
30
#ifdef ETHERNETSERVER_MAX_CLIENTS
31
#define ETHERNETSERVER_BACKLOG ETHERNETSERVER_MAX_CLIENTS
32
#else
33
#define ETHERNETSERVER_MAX_CLIENTS 10
34
#define ETHERNETSERVER_BACKLOG 10
35
#endif
36
37
class
EthernetClient
;
38
42
class
EthernetServer
:
public
Server
43
{
44
45
public
:
52
EthernetServer
(uint16_t port, uint16_t max_clients = ETHERNETSERVER_MAX_CLIENTS);
57
virtual
void
begin
();
63
void
begin
(
IPAddress
addr);
69
bool
hasClient
();
75
EthernetClient
accept
();
82
virtual
size_t
write
(uint8_t b);
90
virtual
size_t
write
(
const
uint8_t *buffer,
size_t
size);
97
size_t
write
(
const
char
*str);
105
size_t
write
(
const
char
*buffer,
size_t
size);
106
107
private
:
108
uint16_t port;
109
std::list<int> new_clients;
110
std::vector<int> clients;
111
uint16_t max_clients;
112
int
sockfd;
113
118
void
_accept();
119
};
120
121
#endif
EthernetServer::EthernetServer
EthernetServer(uint16_t port, uint16_t max_clients=ETHERNETSERVER_MAX_CLIENTS)
EthernetServer constructor.
EthernetClient
Definition:
EthernetClient.h:43
EthernetServer::accept
EthernetClient accept()
Get the new connected client.
EthernetServer
EthernetServer class.
Definition:
EthernetServer.h:42
EthernetServer::hasClient
bool hasClient()
Verifies if a new client has connected.
EthernetServer::write
virtual size_t write(uint8_t b)
Write a byte to all clients.
IPAddress
A class to make it easier to handle and pass around IP addresses.
Definition:
IPAddress.h:32
EthernetServer::begin
virtual void begin()
Listen for inbound connection request.
Copyright (C) 2013-2026 Sensnology AB. Generated by
doxygen
1.8.17