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 8300753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:40:29+00:00 2026-06-08T16:40:29+00:00

What I am wanting to do is create a SocketStreamListener and connect to it

  • 0

What I am wanting to do is create a SocketStreamListener and connect to it (on localhost). Then connect to it and send it a message. Very simple stuff and it’s all done here in an official demo but I want to understand it and use this logic in my own application.

The Problem

I have created a new Windows Metro C# application project and have this code to create a listener on my MainPage:

private void Button_Click(object sender, RoutedEventArgs e)
{
    StreamSocketListener listener = new StreamSocketListener();
    greetingOutput.Text = "Hello, " + nameInput.Text + "!";
}

but I get this error:

An exception of type ‘System.UnauthorizedAccessException’ occurred in
HelloWorld.exe but was not handled in user code

WinRT information: At least one of either InternetClientServer or
PrivateNetworkClientServer capabilities is required to listen for or
receive traffic

Additional information: Access is denied.

If there is a handler for this exception, the program may be safely
continued.

The same code works in the official demo though.

What am I missing?
What am I doing wrong?

  • 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-06-08T16:40:31+00:00Added an answer on June 8, 2026 at 4:40 pm

    You need to configure your application to require one or both of the necessary capabilities depending on your needs:

    1. internetClientServer

      Your Internet connection, including incoming unsolicited connections from the Internet – the app can send information to or from your computer through a firewall. You do not need to declare internetClient if this capability is declared.

    2. privateNetworkClientServer

      A home or work network – the app can send information to or from your computer and other computers on the same network.

    (From the documentation at http://msdn.microsoft.com/en-us/library/windows/apps/br211423.aspx)

    Also see this article for more information on how capabilities works: http://msdn.microsoft.com/en-us/library/windows/apps/hh464936.aspx

    Internet and public networks

    The internetClient capability provides outbound access to the Internet and public networks through the firewall. Almost all web apps use this capability. The internetClientServer capability provides inbound and outbound access to the Internet and public networks through the firewall.

    Home and work networks

    The privateNetworkClientServer capability provides inbound and outbound access to home and work networks through the firewall. This capability is typically used for games that communicate across the local area network (LAN), and for apps that share data across a variety of local devices. If your app specifies musicLibrary, picturesLibrary, or videosLibrary, you don’t need to use this capability to access the corresponding library in a Home Group.

    You need to declare which capabilities your app requires (and therefore has access to)
    in your package manifest. Here’s a step by step guide on how to do that: http://msdn.microsoft.com/en-us/library/windows/apps/br211477.aspx

    You can use the Manifest Designer in Visual Studio to edit these capabilities.
    Just locate and open the file in your solution named package.appxmanifest and the Manifest Designer should open.

    App Manifest Designer

    Select the capabilities tab and the network related capabilities your app requires and you should be good to go.

    Link to the documentation about the App Manifest Designer: http://msdn.microsoft.com/en-us/library/windows/apps/br230259(v=vs.110).aspx

    Regarding the last paragraph

    If there is a handler for this exception, the program may be safely continued.

    It is simply saying that you may wrap your code using the StreamSocketListener in a try-catch block. This is a good thing if you want to handle the missing capabilities gracefully inside your application:

    private void Button_Click(object sender, RoutedEventArgs e)
    { 
        try 
        {
             StreamSocketListener listener = new StreamSocketListener();
             greetingOutput.Text = "Hello, " + nameInput.Text + "!";
        } 
        catch(UnauthorizedAccessException exc) 
        {
             // Act on the missing capability. Log it and/or warn the user.
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a very simple question. I often find myself wanting to create a
I am wanting to create a VB.Net app that checks a database and then
So since I'm still wanting to create a simple Pac-Man clone by December, I'm
I'm wanting to create an android app that gathers information and then uploads to
ok so in learning this javascript here, im wanting to create a panel in
I am wanting to create a sqlDB on my server, I am very new
I am wanting to create a PHP loop to get all of the ids
I've been wanting to create a simple text-manipulating extension for Visual Studio for a
I'm wanting to create a remote NuGet server. I've followed the instructions here: http://docs.nuget.org/docs/creating-packages/hosting-your-own-nuget-feeds
I'm wanting to create a stopwatch so to speak in order to score my

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.