I basically try to reproduce the Socket example from here: http://www.silverlightshow.net/items/Sockets-and-their-implementation-in-SL2-Beta-1-including-a-chat-like-example.aspx
I only made a small change in the client side, i.e.,
String safeHost = "127.0.0.1";
int port = 4509;
Then I got this permission error? Any idea why?
Unhandled Error in Silverlight Application An attempt was made to access a socket in a way forbidden by its access permissions.
I believe that the way the socket security checks work you need to use the same url string that your application uses. to make sure i am using the correct string i have always used this to construct my DNSEndPoint:
I have used this exact code in a similar chat application. By using the
Application.Current.Host.Source.DnsSafeHostProperty you ensure that you are using the same Dns Name to access the server with the socket that the browser is using for HttpRequests.Also are you serving the access policy file on port 943, this is another requirement of the socket support in Silverlight.
EDIT
To Confirm that you are serving the policy file you can do a number of things.
here is the code i used to serve the policy file:
Then to use it:
I hosted this “server” in the same process that was running the rest of the Chat Server component. Set a breakpoint in HandleClient to confirm if it is receiving the request.