Thanks Uwe.

On Fri, Nov 6, 2015 at 5:17 PM, Valery Ushakov <u...@stderr.spb.ru> wrote:

> Amit Ashara <ashara.a...@gmail.com> wrote:
>
> > Do you mean that instead of using pcb I should have another tcp_pcb e,g,
> > newpcb that is assigned from the pcb in the call back.
> >
> > struct tcp_pcb *newpcb;
> >
> > static err_t echo_accept(void *arg, struct tcp_pcb *pcb, err_t err)
> >
> > {
> >       LWIP_UNUSED_ARG(arg);
> >       LWIP_UNUSED_ARG(err);
> >
> >       newpcb = pcb;
>
> Exactly.
>
>
> > On Thu, Nov 5, 2015 at 11:28 AM, Valery Ushakov <u...@stderr.spb.ru>
> wrote:
> >
> >> Amit Ashara <ashara.a...@gmail.com> wrote:
> >>
> >> > When a connection is established between the server and the client,
> >> > I can use the tcp_write on the client side to send data in my
> >> > application code.  However the same on the server side is not
> >> > possible.  The pcb that has been used for the server only contains
> >> > the server's address and server's port but not the client's address
> >> > and client's port.  In the receive call back on the server side, I
> >> > can send the data to the client but not outside of the call back.
> >>
> >> You are using wrong pcb.  On the server you start with a listening
> >> pcb.  When your accept callback is called, it's passed a *new* pcb,
> >> that represents the established connection.  You should use that pcb
> >> for tcp_write.  Writing from receive callback works because in the
> >> receive callback the pcb argument is that connection pcb, not the
> >> original listening pcb.
> >>
> >> -uwe
>
> -uwe
>
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to