lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] access to tcp_pcb data from socket+


From: Joel Cunningham
Subject: Re: [lwip-users] access to tcp_pcb data from socket+
Date: Wed, 07 Mar 2018 10:47:41 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0



On 03/07/2018 04:05 AM, Mattia Settin wrote:
Hi
For example I need to check the send buffer size (e.i. SO_SNDBUF) which is not implemented options.
Regards

Setting the send buffer size at run-time is not supported. We have a compile time setting TCP_SND_BUF for that.  Are you wanting to only get the current send buffer size?  I'm curious what the use case is.  You can easily use non-blocking sockets and an application specific write buffer. TCP will then copy as much as it can to fill the send buffer and return a partial write.
On Wed, Mar 7, 2018 at 10:55 AM, Mattia Settin <address@hidden> wrote:
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 <address@hidden> 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 list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users



--
Mattia Settin
Software and System Engineer





--
Mattia Settin
Software and System Engineer

Joel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]