[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] altcp API: altcp_active_pcbs
From: |
koszo.simon |
Subject: |
[lwip-users] altcp API: altcp_active_pcbs |
Date: |
Thu, 19 Sep 2019 08:20:29 -0700 (MST) |
Hi everybody,
I have a question about altcp API: Does "altcp_active_pcbs" (or something
similar) exist?
I have an existing tcp raw API application and I want to use Application
layered TCP API. I started to follow this description:
https://www.nongnu.org/lwip/2_1_x/group__altcp__api.html
(which is a very goog easy to understand description by the way)
At the moment my altcp_allocator_t is a NULL pointer so actually my
application should behave as it used to behave before I started to use altcp
API... If I understood this altcp topic well :).
I could successfully change my simple tcp server application from raw API to
altcp API: I could connect to a single tcp port and I got reply from the
server for a simple question (I use an own developped higher level
application/protocol to communicate).
My problem is that my previous application (which used raw API) contained a
functionality which I called "socket braodcast": Every message which is sent
from a specific tcp port is sent to all tcp socket which is connected to
this tcp port and is in ESTABLISHED state.
I am not sure if I solved the task in the best way, but I do this in such a
way that I go through the list of the active pcbs and I send the message
through that pcb which staisfies these conditions.
The problem is that I did not find the "altcp_active_pcbs" pointer which
should be the suitable couple of the "tcp_active_pcbs" pointer.
So that is the reason why I am asking if this "altcp_active_pcbs" (or
something which is similar to it) exists or not. The struct altcp_pcb has
not any member which is similar to the next pointer in struct tcp_pc, so I
am afraid that these altcp_pcbs cannot even make a linked list?
Here you can find my original raw API code for better understanding:
struct tcp_pcb* act_pcb;
INT8U tcp_output_OK = 0;
INT8U j = 0;
for (act_pcb = tcp_active_pcbs; act_pcb != NULL; act_pcb = act_pcb->next)
{ //go through the list of the active pcbs
j++;
if(act_pcb != NULL) {
if (act_pcb->state == ESTABLISHED && act_pcb->local_port == 1001) {
if(tcp_write(act_pcb, &EthTxBuf[EthTxRdIdx], dnum - EthTxRdIdx,
TCP_WRITE_FLAG_COPY) == ERR_OK) {
if(tcp_output(act_pcb) == ERR_OK) { tcp_output_OK++; }
}
}
}
}
Thanks for any answers in advance:
Simon Kószó
--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html
- [lwip-users] altcp API: altcp_active_pcbs,
koszo.simon <=