Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Noam Weissman
Hi, First of all read the lwip readme and every document you can find. Check the echo server example and see how it is written. 1. If both servers are the same write functions and simply pass parameters. You do not need to copy and paste the same code. Use the arg parameter in the call backs

Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Noam Weissman
Jan see his code. He was trying to compare listening port with working port -Original Message- From: lwip-users [mailto:lwip-users-bounces+noam=silrd@nongnu.org] On Behalf Of Jan Menzel Sent: Monday, May 22, 2017 4:00 PM To: lwip-users@nongnu.org Subject: Re: [lwip-users] Raw api +

Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Simon Goldschmidt
Noam Weissman wrote: > If you use Lwip 1.41 the tcp_accepted function should accept the SERVER pcb > and not the new connection pcb In the initial post, he said he's using 2.0.2, not 1.4.1 (what's that 1.41 again?)   > Your accept function is wrong. I fail to see the difference between your

Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Jan Menzel
Hi Werner! In you initial post you wrote, that your system catches a Hardfault. A Hardfault indicates are general MCU failure which can be something like memory corruption, stack problem, unaligned address, division by zero or even escalated from some other fault. The actual reason can

Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Simon Goldschmidt
Noam Weissman wrote: > Jan see his code. He was trying to compare listening port with working port OK, now I'm confused. In the accept callback, he compared the local port to see for which port the incoming connection was. I don't see what's wrong there? Simon

Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Noam Weissman
Hi, Do you mean two connections that you initiate from your device to two different IP's or two connections in a server ? Your question is not clear ? Noam. From: lwip-users [mailto:lwip-users-bounces+noam=silrd@nongnu.org] On Behalf Of Werner Motz Sent: Monday, May 22, 2017 1:29 PM

Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Werner Motz
Hi, I apologize myself. I (uC) am the server and I initiate two connections with IP_ADDR_ANY but different ports. The PC is the Client and from here I connect to the Server. Hi, Do you mean two connections that you initiate from your device to two different IP's or two

[lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Werner Motz
Hello, I am using lwip 2.0.2 RAW API and I have a question depending multiple TCP Connections. I create two connections without problems. Over each of them I can send and receive data. When a single client sends me data every 1ms, my receive callback function (tcp_recv(pcb, myCallback1)) gets

Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Noam Weissman
So there are two separate servers with each handling one connection, correct ? So what is the problem ? Every server should have its own pcb and every connection has its own separate pcb You are doing something wrong, check your code. From: lwip-users

Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Werner Motz
U are right, but I don't know where the mistake is. I can debug it and the breakpoints in myCallback1 and myCallback2 are hit. The also debugged the init_Server and the binding or listen gave no error. Both connections are initiated correctly. I do init: void init_Server(void) {

Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Noam Weissman
Simon, I did this while working on my own code, was not paying attention My mistake, I thought that pcb->local_port means working port while pcb->listenr->local_port is the server port OK :-( Noam. -Original Message- From: lwip-users

Re: [lwip-users] Raw api + multiple TCP Connections

2017-05-22 Thread Simon Goldschmidt
Noam Weissman wrote: > My mistake, I thought that pcb->local_port means working port while > pcb->listenr->local_port is the server port OK, just to clarify this for anyone reading: pcb->local_port of an accepted pcb is (by definition!) the same as the listener's local_port! Simon