Hi
Yes you are right but I don't need to touch the pcb, just some check on the
pcb.
getpeername  stores the address of the peer that is connected socket (it
dosen't return the pcb structure).
Which is the api for retrive the connection tcp data for a certain socket ?
Thanks
reagards
m


On Wed, Mar 7, 2018 at 10:26 AM, Jens Nielsen <d...@telia.com> wrote:

> Hi
>
> The short answer is: don't. If you're using the socket api you're not
> touching the pcb.
>
> What do you really want to do?  There are basically two options here
>
> a) Just like your question about getpeername, there's an api for that.
> Google is your friend.
> or
> b) Since the beginning of time people have managed without it, in which
> case you're probably doing something weird and you're probably on your own
>
> BR /Jens
>
>
> On 2018-03-07 10:07, Mattia Settin wrote:
>
> Dear all
> I developing an application wih lwip 2.0.3 using socket bsd.
> The tcp server performs the following operation:
> s = socket()
> bind
> accept //wait a new connection
> read  //packet received
>
> I need to perform some check on the pcb data of my socket.
> I note the get_socket is defined as static and the get_sockopt do not
> return all data I need.
> I solve adding following function in socket.c:
> struct tcp_pcb * lwip_getsockpcb(int s)
> {
>   struct lwip_sock *sock = get_socket(s);
>   if (!sock) {
>     return NULL;
>   }
>   return sock->conn->pcb.tcp;
> }
>
> My question is:
> how can acces to the tcp_pcb of my socket with out modify the library ?
> Which is the smart way ?
> Thank all
> regard
>
>
> --
> Mattia Settin
> Software and System Engineer
>
>
>
>
> _______________________________________________
> lwip-users mailing 
> listlwip-users@nongnu.orghttps://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>



-- 
Mattia Settin
Software and System Engineer
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to