-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to get a non blocking socket? #92
Comments
Hi - fcntl() is not present in the Azure Sphere SDK. The SDK only includes APIs that Microsoft can presently support and maintain binary compatibility of across OS updates, and for the supported lifetimes of those devices. The SDK intentionally excludes some standard POSIX APIs and Linux syscalls that do not presently meet these criteria, even if they are physically present within the kernel or OS. Instead, to get a non-blocking socket, it may help to look is this file in one of our samples. Specifically, the sending socket is opened as non-blocking:
|
That example is for getting a non-blocking socket bind to the local server port. I need to get a socket for client connection so don't need to bind(..) but connect(..) and tried already to change the bind to connect in the OpenIpV4Socket and is not working. If there are some things intentionally excluded they should be documented as standard Linux api is to use the fcntl to make a non-blocking socket. I still need an example code that works to create a client non-blocking socket for communication with another server. |
Hi - that's interesting. Our dev teamm would expect this to be enough:
In what way is this not working? The dev team also advise that the connection may be async: i.e., connect() will return immediately. So you then have to wait (epoll/select/etc) on the socket fd and then when signalled check getsockopt() to see if the socket is writeable. If this doesn't help, please share an example of the failing code. Thanks. |
Thanks, |
tried the following:
`#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <fcntl.h>
struct addrinfo hints, * res;
int sockfd;
but it looks that F_SETFL is not defined ?
How do I get a non blocking socket ?
The text was updated successfully, but these errors were encountered: