Hello
Thanks Quinn for taking the time to answer but to be honest I don't understand the answer... I'm talking about binding a socket in order to listen on it.
A little snippet of code is better than a long speech, here is what I'm trying to do:
int main(int argc, const char * argv[]) {
struct sockaddr_in addr;
int sock, res;
addr.sin_port = htons(80);
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("192.168.1.30"); // Works with htonl(INADDR_ANY)
sock = socket (AF_INET, SOCK_STREAM, 0);
res = bind (sock, (struct sockaddr *)&addr, sizeof(addr));
if (res < 0)
perror ( "bind" );
res = listen (sock, 1);
if (res < 0)
perror ( "listen" );
res = close (sock);
if (res < 0)
perror ( "close" );
return 0;
}
Binding on lower ports always returns error 13 Permission Denied with any other value than ANY_ADDR.
Shouldn't we use our helpertool or is there a way to do without it?
Yannick TRINH @ 4D SAS
Post
Replies
Boosts
Views
Activity
Hello
I'm coming back to the subject because I always experiment issues with lower ports without helpertools.
I was told earlier in this thread that no helpertool was needed anymore to bind on a lower port but it seems that this is partially true.
Actually, if we bind on a socket using ANY_ADDR, no problem all is working perfectly and no helpertool is needed. But when using one of the valid addresses of the machine (say "192.168.1.30" for example), bind call systematically returns an error 13 (Permission denied). This issue does not occur when with an helpertool whatever the address used.
Questions: is this an expected behavior (I don't think so), a bug ? Is there a way to get around the problem (other than calling the helpertool we just removed)? A magic trick ? Any idea ?
Thank you in advance for your answers
Yannick TRINH
4D SAS
Thanks a lot Matt and Quinn for your answers, I just needed to read that this change of behavior was expected and you just made my day :)
Yannick TRINH
4D SAS
Hi Matt
No particular problem, since we used to use a PriviledgedHelperTool (which took some time to develop with a lot of sweat and efforts :)) to bind on the lower ports and we recently realized by accident that it's now perfectly useless.
So the goal of my question is to have an official confirmation that this is a normal behavior (we now can bind on lower ports without any PriviledgedHelperTool) and that therefore we can stop installing our PriviledgedHelperTool.
Thanks in advance for your help
Yannick TRINH
4D SAS