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/TCPSocketServer.cpp
- Revision:
- 12:d130abe9d4a8
- Parent:
- 10:cadac6bcd169
- Child:
- 13:6f469f76a76a
diff -r 274fda7476d0 -r d130abe9d4a8 Socket/TCPSocketServer.cpp --- a/Socket/TCPSocketServer.cpp Thu Jul 17 07:13:27 2014 +0000 +++ b/Socket/TCPSocketServer.cpp Mon Jul 21 05:12:11 2014 +0000 @@ -23,6 +23,7 @@ // Server initialization int TCPSocketServer::bind(int port) { + listen_port = port; if (_sock_fd < 0) { _sock_fd = eth->new_socket(); if (_sock_fd < 0) { @@ -71,8 +72,21 @@ char host[16]; snprintf(host, sizeof(host), "%d.%d.%d.%d", (ip>>24)&0xff, (ip>>16)&0xff, (ip>>8)&0xff, ip&0xff); uint16_t port = eth->sreg<uint16_t>(_sock_fd, Sn_DPORT); + + // change this server socket to connection socket. connection._sock_fd = _sock_fd; connection._is_connected = true; connection.set_address(host, port); + + // and then, for the next connection, server socket should be assigned new one. + _sock_fd = -1; // want to assign new available _sock_fd. + if(bind(listen_port) < 0) { + printf("No more server socket"); + } else { + //return -1; + if(listen(1) < 0) { + printf("No more server socket"); + } + } return 0; }