Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Socket and Policy file and localhost RSS

6 replies

Last post Jul 29, 2008 02:57 PM by GuinnessKMF

(1)
  • Lucker

    Lucker

    Member

    7 Points

    15 Posts

    Socket and Policy file and localhost

    Jul 28, 2008 02:22 AM | LINK

    Currrently i am using silverlight 2 beta 2. I was noticed that socket connection needs a policy service run on port 943 and return a policy file like this:

    <?xml version="1.0" encoding ="utf-8"?>
    <access-policy>
      <cross-domain-access>
        <policy>
          <allow-from>
            <domain uri="*" />
          </allow-from>
          <grant-to>
            <socket-resource port="8000" protocol="tcp" />
          </grant-to>
        </policy>
      </cross-domain-access>
    </access-policy>

    i have deploy a policy server which i was found on many other demos, and i am sure its work fine.

    then i am trying to connect to localhost:8000 and silverlight socket always report accessdenied. Code(vb.net):

            m_UploadSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
            Dim socketArgs As New SocketAsyncEventArgs
            socketArgs.RemoteEndPoint = New DnsEndPoint("localhost",8000)

            AddHandler socketArgs.Completed, AddressOf OnConnect
            m_UploadSocket.ConnectAsync(socketArgs)

    ......

         Private Sub OnConnect(ByVal sender As Object, ByVal e As SocketAsyncEventArgs)
            If e.SocketError = SocketError.Success Then  // its alway SocketError.AccessDenied

    ......

    is there any problem with policy file or code?need help

    thanks in advance.

  • Lucker

    Lucker

    Member

    7 Points

    15 Posts

    Re: Socket and Policy file and localhost

    Jul 28, 2008 08:14 AM | LINK

    [:'(]

  • GuinnessKMF

    GuinnessKMF

    Member

    222 Points

    58 Posts

    Re: Socket and Policy file and localhost

    Jul 28, 2008 05:22 PM | LINK

    Try port 4530; Port 8000 is still restricted in SL2B2.

    -Kellen
  • Lucker

    Lucker

    Member

    7 Points

    15 Posts

    Re: Socket and Policy file and localhost

    Jul 29, 2008 01:26 AM | LINK

    how about port 80? could i connect to port 80?[:(]

  • Nuno.Godinho

    Nuno.Godinho

    Member

    264 Points

    42 Posts

    Re: Re: Socket and Policy file and localhost

    Jul 29, 2008 01:44 AM | LINK

    Hi Lucker,

         Your problem with "Access Denied" will continue unless you use a different port because  Silverlight 2 has limitations of using TCP ports and only from 4502 to 5432 are available, but you can check here how you can work with Sockets in Silverlight 2 Beta 2.

    Hope this answers your question.

    Nuno Filipe Godinho [MVP ASP/ASP.NET]
  • Lucker

    Lucker

    Member

    7 Points

    15 Posts

    Re: Socket and Policy file and localhost

    Jul 29, 2008 02:06 AM | LINK

    thanks a lot. its the very problem.

    [:D]

  • GuinnessKMF

    GuinnessKMF

    Member

    222 Points

    58 Posts

    Re: Re: Socket and Policy file and localhost

    Jul 29, 2008 02:57 PM | LINK

    I'm with you lurker on not liking this limitation, I sincerly hope that the Silverlight team will consider adding the ability for the user to approve the application for using other ports to various servers without policy files, with an appropriate, user initiated, dialog for approval (Like the expand disk space).  Silverlight is positioned perfectly to replace many network client applications, but the restriction is crippling.

    -Kellen