It seems that the classic environment does not release bindings to ports used by classic applications. They are released only if classic is quit.
While classic is active, bind() gives an "Address already in use" error (errno 48).
Question: How can I override the binding or how can I unbind that port before I bind to it?
code looks like:
sok = socket(AF_INET, SOCK_STREAM, 0);
setsockopt(sok, SOL_SOCKET, SO_REUSEADDR, &len, sizeof(len));
memset(&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(thePortNumber);
seteuid(0);
res = bind(sok, (struct sockaddr *) &addr, sizeof (addr));
setuid(pw->pw_uid);
// now res is -1 and errno is 48 if thePortNumber has been used by
// any classic application and classic is still active
-