Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: ThingPlug_Ethernet_Example
Fork of GMMP_mbed by
Network/TCPclient/Client.h@5:9bbb6933559b, 2015-08-12 (annotated)
- Committer:
- hkjung
- Date:
- Wed Aug 12 08:58:58 2015 +0000
- Revision:
- 5:9bbb6933559b
- Parent:
- 0:7e575e5f88ec
Ethernet interface reinitialize code added
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| lesmin | 0:7e575e5f88ec | 1 | #ifndef Client_h |
| lesmin | 0:7e575e5f88ec | 2 | #define Client_h |
| lesmin | 0:7e575e5f88ec | 3 | |
| lesmin | 0:7e575e5f88ec | 4 | #include "TCPSocketConnection.h" |
| lesmin | 0:7e575e5f88ec | 5 | |
| lesmin | 0:7e575e5f88ec | 6 | #include "Print.h" |
| lesmin | 0:7e575e5f88ec | 7 | #include "Utility.h" |
| lesmin | 0:7e575e5f88ec | 8 | |
| lesmin | 0:7e575e5f88ec | 9 | /* |
| lesmin | 0:7e575e5f88ec | 10 | * TCP Client |
| lesmin | 0:7e575e5f88ec | 11 | */ |
| lesmin | 0:7e575e5f88ec | 12 | class Client : public Print { |
| lesmin | 0:7e575e5f88ec | 13 | public: |
| lesmin | 0:7e575e5f88ec | 14 | Client(); |
| lesmin | 0:7e575e5f88ec | 15 | ~Client(); |
| lesmin | 0:7e575e5f88ec | 16 | |
| lesmin | 0:7e575e5f88ec | 17 | virtual int connect(const char *host, uint16_t port); |
| lesmin | 0:7e575e5f88ec | 18 | virtual size_t write(uint8_t); |
| lesmin | 0:7e575e5f88ec | 19 | //virtual size_t write(const uint8_t *buf, size_t size); |
| lesmin | 0:7e575e5f88ec | 20 | virtual size_t write(char *buf, size_t size); //lesmin |
| lesmin | 0:7e575e5f88ec | 21 | virtual int available(); |
| lesmin | 0:7e575e5f88ec | 22 | virtual int read(); |
| lesmin | 0:7e575e5f88ec | 23 | virtual void flush(); |
| lesmin | 0:7e575e5f88ec | 24 | virtual void stop(); |
| lesmin | 0:7e575e5f88ec | 25 | virtual uint8_t connected(); |
| lesmin | 0:7e575e5f88ec | 26 | private: |
| lesmin | 0:7e575e5f88ec | 27 | virtual int read(uint8_t *buf, size_t size); |
| lesmin | 0:7e575e5f88ec | 28 | uint8_t _buf[1]; |
| lesmin | 0:7e575e5f88ec | 29 | uint8_t _len; |
| lesmin | 0:7e575e5f88ec | 30 | TCPSocketConnection _sock; |
| lesmin | 0:7e575e5f88ec | 31 | }; |
| lesmin | 0:7e575e5f88ec | 32 | |
| lesmin | 0:7e575e5f88ec | 33 | #endif |
