[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Can I use two ports at once, on same net_if?
From: |
Stephen Cowell |
Subject: |
[lwip-users] Can I use two ports at once, on same net_if? |
Date: |
Mon, 14 Sep 2020 14:06:11 -0500 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 |
I'm trying to use one net_if for two ports at once... sorry if this
looks dumb. Using a modified 1.4.1 in raw mode.
I set up two pcb's... I have two different tcp_accept()'s for them. The
incoming packets appear to go to the proper places, but the connection
is reset after the other one is opened. I had to open up
MEMP_NUM_TCP_PCB_LISTEN to two from one. Obviously the two _accept()'s
set up two _receive()'s.
/**
* \brief HTTP server init.
*/
void httpd_init(void)
{
struct tcp_pcb *pcb;
struct tcp_pcb *pcbHttp;
pcbHttp = tcp_new();
tcp_bind(pcbHttp, IP_ADDR_ANY, 80);
pcbHttp = tcp_listen(pcbHttp);
tcp_accept(pcbHttp, http_accept);
pcb = tcp_new();
tcp_bind(pcb, IP_ADDR_ANY, 502);// was 80 slc
pcb = tcp_listen(pcb);
tcp_accept(pcb, modBus_accept);
}
Is this possible? Is this how it's supposed to be done? Can I do this
without setting up two different net_if's? Either one works fine with
the other commented out.
__
Steve
.
--
Stephen Cowell
Project Manager/Engineer
Plasmability LLC
Office (512) 267-7087
Cell (512) 632-8593 (best)
www.plasmability.com
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] Can I use two ports at once, on same net_if?,
Stephen Cowell <=