Issue with select after SSL_get_wfd

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with select after SSL_get_wfd

Grace Priscilla Jero
Hi All,

I want to know the status of the SSL_WRITE for DTLS on UDP on a non-blocking socket. Only if the other end does the recvfrom I want to continue with subsequent SSL_WRITE.

Below is what I have tried.

//Making the socket blocking - if I dont do below then select call hangs

if (wfd = SSL_get_wfd(ssl))
    {
            flags = fcntl(wfd, F_GETFL);
            flags &= ~O_NONBLOCK;
            fcntl(a_wfd, F_SETFL, flags);

                FD_SET(wfd, &write_fds);
    }
len = SSL_write(          ssl,
                                     buf,
                                     elen);

i = select(wfd+1, NULL, &write_fds, 0, 0);

The other side has not yet done the SSL_read but i is "1".
Is their something wrong with this?

Thanks,
Grace


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: Issue with select after SSL_get_wfd

Hugh Maaskant
Hi Grace,

UDP is a datagram service - think of it as “fire and forget”. So the sending socket will not know if or when the packet has been delivered to the receiver, let alone that it has been consumed. You could, of course, create your own application level acks and retries etcetera, but before you know it you are rebuilding TCP.

See e.g. https://www.diffen.com/difference/TCP_vs_UDP for a comparison between UDP and TCP.

rgds,

Hugh

On 16 Feb 2018, at 04:35, Grace Priscilla Jero <[hidden email]> wrote:

Hi All,

I want to know the status of the SSL_WRITE for DTLS on UDP on a non-blocking socket. Only if the other end does the recvfrom I want to continue with subsequent SSL_WRITE.

Below is what I have tried.

//Making the socket blocking - if I dont do below then select call hangs

if (wfd = SSL_get_wfd(ssl))
    {
            flags = fcntl(wfd, F_GETFL);
            flags &= ~O_NONBLOCK;
            fcntl(a_wfd, F_SETFL, flags);

                FD_SET(wfd, &write_fds);
    }
len = SSL_write(          ssl,
                                     buf,
                                     elen);

i = select(wfd+1, NULL, &write_fds, 0, 0);

The other side has not yet done the SSL_read but i is "1".
Is their something wrong with this?

Thanks,
Grace

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: Issue with select after SSL_get_wfd

Grace Priscilla Jero
Thankyou Hugh,
I know that it is datagram and we are not acknowledged. I just was looking for a way if SSL will be aware whether the packet is consumed or not.
or anyway we can get the status from SSL on the packet consumption.

Thanks,
Grace

On Fri, Feb 16, 2018 at 4:13 PM, Hugh Maaskant <[hidden email]> wrote:
Hi Grace,

UDP is a datagram service - think of it as “fire and forget”. So the sending socket will not know if or when the packet has been delivered to the receiver, let alone that it has been consumed. You could, of course, create your own application level acks and retries etcetera, but before you know it you are rebuilding TCP.

See e.g. https://www.diffen.com/difference/TCP_vs_UDP for a comparison between UDP and TCP.

rgds,

Hugh

On 16 Feb 2018, at 04:35, Grace Priscilla Jero <[hidden email]> wrote:

Hi All,

I want to know the status of the SSL_WRITE for DTLS on UDP on a non-blocking socket. Only if the other end does the recvfrom I want to continue with subsequent SSL_WRITE.

Below is what I have tried.

//Making the socket blocking - if I dont do below then select call hangs

if (wfd = SSL_get_wfd(ssl))
    {
            flags = fcntl(wfd, F_GETFL);
            flags &= ~O_NONBLOCK;
            fcntl(a_wfd, F_SETFL, flags);

                FD_SET(wfd, &write_fds);
    }
len = SSL_write(          ssl,
                                     buf,
                                     elen);

i = select(wfd+1, NULL, &write_fds, 0, 0);

The other side has not yet done the SSL_read but i is "1".
Is their something wrong with this?

Thanks,
Grace

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users



--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: Issue with select after SSL_get_wfd

Michael Richardson

Grace Priscilla Jero <[hidden email]> wrote:
    > Thankyou Hugh, I know that it is datagram and we are not
    > acknowledged. I just was looking for a way if SSL will be aware whether
    > the packet is consumed or not.  or anyway we can get the status from
    > SSL on the packet consumption.

Yes, that's because you are trying to figure out if the socket has data on it
that SSL needs so that you can switch to the correct SSL* for the next
processing.

That's why trying to do it all with one socket is a problem.

--
]               Never tell me the odds!                 | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works        | network architect  [
]     [hidden email]  http://www.sandelman.ca/        |   ruby on rails    [


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

signature.asc (497 bytes) Download Attachment