none
Socket non-blocking RRS feed

  • Question

  • I lookig for example for non-blocking socket

    Note: ioctl() and fctl() is not allowed...

    I observe a strange condition: recv(1 byte) is non-blocked, recv(N bytes) blocked....

    Thursday, August 22, 2019 4:49 PM

Answers

  • Hi WizIO.bg,

    I have an update from product group:

    Best place to look is this file in one of our samples.


    Specifically, the sending socket is opened as non-blocking:

        int sockType = SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK;
        serverState->listenFd = OpenIpV4Socket(ipAddr, port, sockType);

    And HandleClientReadEvent() and HandleClientWriteEvent() show how to avoid blocking if all bytes can't be sent or received immediately.
    Wednesday, September 4, 2019 10:00 PM
    Owner

All replies