Skip to content

Commit f318a96

Browse files
philbowlesserek4
authored andcommitted
first cut
1 parent ca8ac5f commit f318a96

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11

2-
.DS_Store

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# AsyncTCP
2-
[![Build Status](https://travis-ci.org/me-no-dev/AsyncTCP.svg?branch=master)](https://travis-ci.org/me-no-dev/AsyncTCP) ![](https://github.com/me-no-dev/AsyncTCP/workflows/Async%20TCP%20CI/badge.svg) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/2f7e4d1df8b446d192cbfec6dc174d2d)](https://www.codacy.com/manual/me-no-dev/AsyncTCP?utm_source=github.com&utm_medium=referral&utm_content=me-no-dev/AsyncTCP&utm_campaign=Badge_Grade)
32

4-
### Async TCP Library for ESP32 Arduino
3+
## Async TCP Library for ESP32 Arduino
54

6-
[![Join the chat at https://gitter.im/me-no-dev/ESPAsyncWebServer](https://badges.gitter.im/me-no-dev/ESPAsyncWebServer.svg)](https://gitter.im/me-no-dev/ESPAsyncWebServer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
This is a fully asynchronous TCP library much like the original, apart form the fact that it works properly.
76

8-
This is a fully asynchronous TCP library, aimed at enabling trouble-free, multi-connection network environment for Espressif's ESP32 MCUs.
7+
## What's fixed
98

10-
This library is the base for [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer)
9+
95% of the API is the same as ESPAsyncTCP (the ESP8266 version) apart from one minor problem: This lib does not pass through the TCP PSH flag, which means you can never receive more than N buffers' worth of data (where N is implementation-dependent) because you cannot tell which is the last packet in a multi-packet > buffer size set of data. Clue: It's the one with the PSH flag set. See the problem?
1110

12-
## AsyncClient and AsyncServer
13-
The base classes on which everything else is built. They expose all possible scenarios, but are really raw and require more skills to use.
11+
So, PSH flag collected on TCP recv, saved and made available to new API call (same as ESPAsyncTCP)
12+
13+
```cpp
14+
bool isRecvPush(); // is the PSH flag set, i.e. is this the last packet?
15+
```

library.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=AsyncTCP
2-
version=1.1.1
3-
author=Me-No-Dev
4-
maintainer=Me-No-Dev
5-
sentence=Async TCP Library for ESP32
6-
paragraph=Async TCP Library for ESP32
2+
version=0.0.1
3+
author=Phil Bowles
4+
maintainer=Phil Bowles
5+
sentence=WORKING Async TCP Library for ESP32
6+
paragraph=WORKING Async TCP Library for ESP32
77
category=Other
8-
url=https://github.com/me-no-dev/AsyncTCP
8+
url=https://github.com/philbowles/ESPAsyncTCP-master
99
architectures=*

src/AsyncTCP.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ AsyncClient::AsyncClient(tcp_pcb* pcb)
562562
, _rx_since_timeout(0)
563563
, _ack_timeout(ASYNC_MAX_ACK_TIME)
564564
, _connect_port(0)
565+
, _recv_pbuf_flags(0)
565566
, prev(NULL)
566567
, next(NULL)
567568
{
@@ -931,6 +932,8 @@ int8_t AsyncClient::_recv(tcp_pcb* pcb, pbuf* pb, int8_t err) {
931932
_pb_cb(_pb_cb_arg, this, b);
932933
} else {
933934
if(_recv_cb) {
935+
// pmb
936+
_recv_pbuf_flags = b->flags;
934937
_recv_cb(_recv_cb_arg, this, b->payload, b->len);
935938
}
936939
if(!_ack_pcb) {

src/AsyncTCP.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class AsyncClient {
122122
void ackPacket(struct pbuf * pb);//ack pbuf from onPacket
123123
size_t ack(size_t len); //ack data that you have not acked using the method below
124124
void ackLater(){ _ack_pcb = false; } //will not ack the current packet. Call from onData
125+
bool isRecvPush(){ return !!(_recv_pbuf_flags & PBUF_FLAG_PUSH); }
125126

126127
const char * errorToString(int8_t error);
127128
const char * stateToString();
@@ -168,6 +169,7 @@ class AsyncClient {
168169
uint32_t _rx_since_timeout;
169170
uint32_t _ack_timeout;
170171
uint16_t _connect_port;
172+
u8_t _recv_pbuf_flags;
171173

172174
int8_t _close();
173175
void _free_closed_slot();

0 commit comments

Comments
 (0)