Mbed library for ENC28J60 Ethernet modules. Full support for TCP/IP and UDP Server, Client and HTTP server (webserver). DHCP and DNS is included.

Dependents:   mBuino_ENC28_MQTT Nucleo_Web_ENC28J60 Nucleo_Web_ENC28J60_ADC Serial_over_Ethernet ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TcpServer.h Source File

TcpServer.h

00001 /*
00002  UIPServer.h - Arduino implementation of a UIP wrapper class.
00003  Copyright (c) 2013 Norbert Truchsess <norbert.truchsess@t-online.de>
00004  All rights reserved.
00005 
00006  This program is free software: you can redistribute it and/or modify
00007  it under the terms of the GNU General Public License as published by
00008  the Free Software Foundation, either version 3 of the License, or
00009  (at your option) any later version.
00010 
00011  This program is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018   */
00019 #ifndef TCPSERVER_h
00020 #define TCPSERVER_h
00021 
00022 #include "TcpClient.h"
00023 
00024 class UipEthernet;
00025 
00026 class TcpServer
00027 {
00028 public:
00029     TcpServer();
00030     void        open(UipEthernet* ethernet);
00031     void        bind(uint8_t port);
00032     void        bind(const char* ip, uint8_t port);
00033     void        listen(uint8_t conns);
00034     TcpClient*  accept();
00035     size_t      send(uint8_t);
00036     size_t      send(const uint8_t* buf, size_t size);
00037 private:
00038     uint16_t    _port;
00039     uint8_t     _conns;
00040 };
00041 #endif