Comments (4)
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:
int sockType = SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK;
serverState->listenFd = OpenIpV4Socket(ipAddr, port, sockType);
from azure-sphere-samples.
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.
from azure-sphere-samples.
Hi - that's interesting. Our dev teamm would expect this to be enough:
fd = socket(..., <other options> | SOCK_NONBLOCK, ...);
connect(fd, ...);
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.
from azure-sphere-samples.
Thanks,
Tried it again and now is working as you explained above.
from azure-sphere-samples.
Related Issues (20)
- Azure sphere Hub authentication issue HOT 2
- Device is not responding when deploying HOT 13
- Possible Memory Leak in get_device_id.c example HOT 2
- Default Interface HOT 9
- This repo is missing important files
- Get the OS Version of the Device using Azure Sphere Device REST API HOT 5
- How to setup Development Env in Mac HOT 1
- This repo is missing a license file HOT 2
- VSCode: Wi-Fi details not showing up HOT 13
- Reference Code Example for Azure IoT/Tools HOT 4
- Azure sphere Uart baud rate change HOT 7
- Exit EventLoop and restart device after DFU HOT 2
- Azure sphere cloud to device message receiving in device HOT 2
- 3rd party library works on Azure uart sample but doesnt work on Azure Iot sample HOT 4
- Is it possible to clear Uart in azure HOT 5
- Problems with PowerManagement_ForceSystemPowerDown (Powerdown sample) HOT 3
- How to change UART baud rate on Azure after DFU HOT 1
- Deprecated SDK for WifiSetupAndDeviceControlViaBle/Nrf52App
- Wifi Ble Sample Pair key Issue HOT 2
- Wifi disabled automatically in azure sphere HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-sphere-samples.