Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6823821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:49:44+00:00 2026-05-26T21:49:44+00:00

I am trying to set up a SilverLight policy server under MacOSX 10.7.2 (Lion).

  • 0

I am trying to set up a SilverLight policy server under MacOSX 10.7.2 (Lion). This requires that I create and bind a socket to port 943, since SilverLight requests the policy file on this port. Unfortunately, it seems I am unable to bind at that port, as the bind call fails with errno=49. I suppose I do not have access to this port. Perhaps I need root privileges? Or do I need to forward this port to another one that I can bind? I’m a bit new to network programming, so any help is greatly appreciated! I’ve also attached my source code. Perhaps I’m doing something wrong, although it works fine if I use the SilverLight restricted ports 4502-4532, which SilverLight communicates on once the policy file is successfully served.

- (void) start {
    CFSocketRef socket = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, 0, NULL, NULL);
    if (!socket) {
        [self errorWithName:@"Unable to create socket."];
        return;
    }

    int reuse = true;
    CFSocketNativeHandle fileDescriptor = CFSocketGetNative(socket);
    if (setsockopt(fileDescriptor, SOL_SOCKET, SO_REUSEADDR,
                   (void *)&reuse, sizeof(int)) != 0) {
        NSLog(@"Unable to set socket options.");
        return;
    }

    struct sockaddr_in address;
    memset(&address, 0, sizeof(address));
    address.sin_len = sizeof(address);
    address.sin_family = AF_INET;
    address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
    address.sin_port = htons(943);
    CFDataRef addressData = CFDataCreate(NULL, (const UInt8 *)&address, sizeof(address));
    [(id)addressData autorelease];

    CFSocketError error = CFSocketSetAddress(socket, addressData);
    if (error < 0) {
        NSLog(@"Error bind %d\n", errno);  //fails here for port 943.
        return;
    }

    NSFileHandle *listeningHandle = [[NSFileHandle alloc]
                   initWithFileDescriptor:fileDescriptor
                   closeOnDealloc:YES];

    [[NSNotificationCenter defaultCenter]
          addObserver:self
             selector:@selector(receiveIncomingConnectionNotification:)
                 name:NSFileHandleConnectionAcceptedNotification
               object:nil];

    [listeningHandle acceptConnectionInBackgroundAndNotify];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:49:45+00:00Added an answer on May 26, 2026 at 9:49 pm

    Only root has privileges for ports below 1024. Try running your code with sudo and see if that fixes your issue.

    Edit:

    Also, check out man strerror. It will take that relatively meaningless error code and give you a (slightly) more useful string.

    #include <stdio.h>
    #include <string.h>
    
    int main (int argc, char const *argv[])
    {
      printf("%s\n", strerror(49) );
      return 0;
    }
    

    Gives:

    Can't assign requested address
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to set up a basic Silverlight application to run behind the
I am trying to design a set of icons in a Silverlight 4 User
I'm trying to set up UI automation for Silverlight 3. I have a little
I'm building a Silverlight control and I'm trying to set up bindings for the
I have a set of image resources in a Silverlight client and I'm trying
I am trying to create a TreeView from the Silverlight TreeView control. I have
I'm trying to open a silverlight project in Visual Studio 2008 and getting this
I'm trying to set seletected value to a pre-loaded combobox using silverlight with MVVM.
i am trying to create a list of users in Silverlight in which i
I am trying to set the initial focus to a control in a Silverlight

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.