i would like to create 65535 sockets so that i can make a connection to every port on a computer.
it works for an array of, say, 10 sockets but when i try with a large number the socket() function call returns -1.
below is some of my code... please tell me why it is not working and how i can achieve the goal of having a large number of sockets working at the same time. thanks.
# define MAX_PORT 65535
int soc [ MAX_PORT ] ;
int index ;
for ( index = 0 ; index < MAX_PORT ; index ++ )
soc [ index ] = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ) ;
if ( soc [ index ] == ERROR ) return ;