Hi,
I’m currently working on a application that must run a TCP server to send and receive data.
The server is implemented in a standard way via sockets.
Simplified code of TCP server:
sockaddr_in serv_addr = {};
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(port);
m_listen_fd = socket(AF_INET, SOCK_STREAM, 0);
…
setsockopt(m_listen_fd, SOL_SOCKET, SO_BINDTODEVICE, iface.c_str(), iface.size());
bind(m_listen_fd, reinterpret_cast<sockaddr*>(&serv_addr), sizeof(serv_addr));
…
listen(m_listen_fd, 1) ;
m_listen_thread = std::make_uniquestd::thread(&TCPServer::acceptClient, this);
The TCP server can be started and it will wait for a client to connect.
However when a client connects, i got a ernno 1: Operation not permitted.
ssize_t result = recv(m_client_fd, buffer, s_c_recv_buffer_size, MSG_DONTWAIT); // << this will return a errno -1.
I’ve read other topics mentioning that the application probably doesn’t have permission to read/write to the network interface, which is in my case ecm0.
Is there a way to grant my application permission to use the specific network interface? Or is there some other issue that I am not aware of that is causing this error?
Things which I already configured or tried:
- Firewall configuration changed to allow TCP communication on a specific port and interface
- Running processes with sandboxed: false (still operation not permitted error)
- Other samples using a TCP server, also result in an errno -1.
Platform details
- Device: Sierra Wireless WP7700
- Board: MangOH Red
- Firmware version: SWI9X06Y_02.22.12.00
- Legato Framework: 18.9.2.wp77xx
Hope that somebody can help me resolve this issue.