No more update~~ please use W5500Interface.
Fork of EthernetInterfaceW5500 by
wrote:
NO more update for this library.
Please move to this page W5500Interface for newer version.
Import libraryW5500Interface
This is the Interface library for WIZnet W5500 chip which forked of EthernetInterfaceW5500, WIZnetInterface and WIZ550ioInterface. This library has simple name as "W5500Interface". and can be used for Wiz550io users also.
This Library for W5500 users. no need to use lwIP(or S/W TCP/IP) Some update & code clean for W5500 only refer from WIZ550ioInterface, WIZnetLibrary and WiflyInterface.
Thanks for ban4jp. This library forks of WIZ550ioInterface.
Diff: Socket/Socket.cpp
- Revision:
- 10:cadac6bcd169
- Parent:
- 5:fb15c35d1e28
- Child:
- 15:fe68ac753657
--- a/Socket/Socket.cpp Mon Dec 23 13:51:35 2013 +0000 +++ b/Socket/Socket.cpp Thu Jul 17 07:10:36 2014 +0000 @@ -15,25 +15,31 @@ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - + #include "Socket.h" -Socket::Socket() : _sock_fd(-1),_blocking(true), _timeout(1500) { - eth = WIZ820io::getInstance(); +Socket::Socket() : _sock_fd(-1),_blocking(true), _timeout(1500) +{ + eth = WIZnet_Chip::getInstance(); if (eth == NULL) { - error("Socket constructor error: no WIZ8820io instance available!\r\n"); - } + error("Socket constructor error: no W5500 instance available!\r\n"); + } } -void Socket::set_blocking(bool blocking, unsigned int timeout) { +void Socket::set_blocking(bool blocking, unsigned int timeout) +{ _blocking = blocking; _timeout = timeout; } -int Socket::close() { +int Socket::close() +{ + // add this code refer from EthernetInterface. + _sock_fd = -1; return (eth->close(_sock_fd)) ? 0 : -1; } -Socket::~Socket() { +Socket::~Socket() +{ close(); //Don't want to leak }