The following code was working fine on my RedHat 5.1 box, but I recently
upgraded to RedHat 6.0 and now the connect call I gives an EACCES
error. perror() prints "connecting stream socket: Permission denied".
From the connect() man page:
EACCES The user tried to connect to a broadcast address
without having the socket broadcast flag enabled.
I thought that the second line of code should take care of that...
for the help. Please also reply to my email.
if (sock1 < 0)
perror("opening stream socket");
server1.sin_family = AF_INET;
hp1 = gethostbyname("192.168.1.255");
if (hp1 == 0)
fprintf(stderr, "192.168.1.255: unknown host");
bcopy(hp1->h_addr, &server1.sin_addr, hp1->h_length);
server1.sin_port = htons(10276);
if (connect(sock1, &server1, sizeof(server1)) < 0)
perror("connecting stream socket");
if (write(sock1, string1, sizeof(string1)) < 0)
perror("writing on stream socket");