tcpTest continued
This commit is contained in:
parent
c7c0cc12b4
commit
9c1bc47033
@ -20,6 +20,7 @@ uint16_t remotePort = 5000;
|
|||||||
void tcpTestHandler(void *handle) {
|
void tcpTestHandler(void *handle) {
|
||||||
static uint8_t state = 0;
|
static uint8_t state = 0;
|
||||||
int8_t res = 0;
|
int8_t res = 0;
|
||||||
|
int16_t res16 = 0;
|
||||||
int32_t res32 = 0;
|
int32_t res32 = 0;
|
||||||
|
|
||||||
static uint8_t message[] = "Hello world\n\r";
|
static uint8_t message[] = "Hello world\n\r";
|
||||||
@ -77,12 +78,12 @@ void tcpTestHandler(void *handle) {
|
|||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
// coloredMsg(LOG_YELLOW, "tth, now waiting for some input");
|
// coloredMsg(LOG_YELLOW, "tth, now waiting for some input");
|
||||||
uint16_t s = getSn_RX_RSR(TCPTEST_SOCK);
|
res16 = getSn_RX_RSR(TCPTEST_SOCK);
|
||||||
// coloredMsg(LOG_YELLOW, "tth, getSn_RxMAX returns %d", s);
|
// coloredMsg(LOG_YELLOW, "tth, getSn_RxMAX returns %d", res16);
|
||||||
|
|
||||||
if (s > 0) {
|
if (res16 > 0) {
|
||||||
uint8_t *buf = (uint8_t*) malloc(s);
|
uint8_t *buf = (uint8_t*) malloc(res16);
|
||||||
res32 = recv(TCPTEST_SOCK, buf, s);
|
res32 = recv(TCPTEST_SOCK, buf, res16);
|
||||||
coloredMsg(LOG_YELLOW, "tth, recv returns 0x%02x", res32);
|
coloredMsg(LOG_YELLOW, "tth, recv returns 0x%02x", res32);
|
||||||
if (res32 > 0) {
|
if (res32 > 0) {
|
||||||
coloredMsg(LOG_YELLOW, "tth, received: %s", buf);
|
coloredMsg(LOG_YELLOW, "tth, received: %s", buf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user