33template <
typename TcpServer,
typename TcpClient,
typename UdpSocket>
81 *addr = s->remoteIP();
82 *port = s->remotePort();
106 UdpSocket* s =
new UdpSocket();
108 if (!s->begin(portNum)) {
109 printf(
"Can't bind port %d\n", portNum);
124 static ssize_t
sendSocket(TcpClient* sockfd,
const void *buf,
size_t len) {
125 return sockfd->write((uint8_t *)buf, len);
137 static ssize_t
sendUdpSocket(UdpSocket* sockfd,
const void *buf,
size_t len,
139 sockfd->beginPacket(destaddr, destport);
140 sockfd->write((
const uint8_t *)buf, len);
141 if (!sockfd->endPacket()) printf(
"error sending udp packet\n");
154 static int readSocket(TcpClient* sock,
char *buf,
size_t buflen,
156 if (!sock->connected()) {
157 printf(
"client has closed the socket\n");
161 int numAvail = sock->available();
162 if (numAvail == 0 && timeoutmsec != 0) {
165 numAvail = sock->available();
173 int numRead = sock->readBytes(buf, buflen);
If you want to use the framework w/o Arduino you need to provide the implementation of a couple of cl...