I have a Dragonboard 410c running the Debian-based developer build, and I'm having some issues with TCP connections.
This is an example code which simply sets up a listening port, waits for a connection, prints when it gets one and exits, very simple.
Code:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int fd = -1;
int sock = socket(AF_INET, SOCK_STREAM, 0);
if(sock<0){
printf("could not open server socket");
return -1;
}
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(3490);
addr.sin_addr.s_addr = htonl(INADDR_ANY);
if(bind(sock, (struct sockaddr *) &addr, sizeof(addr))<0){
printf("could not bind server socket");
return -1;
}
if(listen(sock, 0)<0){
printf("could not listen on server socket");
return -1;
}
printf("waiting for a connection\n");
fd = ::accept(sock, NULL, NULL);
printf("accepted a connection: %d\n",fd);
return 0;
}
On normal systems it works fine, the output looks like this:
server:
Code:
$ ./a.out
waiting for a connection
<wait until client connects>
accepted a connection: 4
client:
Code:
$ telnet 127.0.0.1 3490
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.
but on the Dragonboard I'm having an odd issue. The server code starts up fine, but as soon as any client tries to connect to it, the connection just times out, the server prints nothing (continues to wait) and I get this in /var/log/messages on the Dragonboard:
Code:
Jun 3 17:45:44 hostname kernel: [ 39.183685] TCP: request_sock_TCP: Possible SYN flooding on port 3490. Dropping request. Check SNMP counters.
Googling the error just comes back with people running servers with thousands of connections, and the solution is changing some sysctl settings to increase the limit, but none of that applies here.
Any idea what could be causing it?