Hi,
I'm in the middle of trying to get my Silverlight application to communicate via sockets with my webserver but I'm having trouble connecting the Silverlight socket to the server.
This is the setup:
My webserver is set to listen to the 5432 port using a TcpListener on IPAddress.Any. I've got a clientaccesspolicy.xml accessable on localhost:943/clientaccesspolicy.xml looking like this:
The webserver hosting the access policy is a homemade one using HttpListeners but that works great using normal WebRequests with silverlight so I cannot see how that would be a problem here.Code:1 <access-policy> 2 <cross-domain-access> 3 <policy> 4 <allow-from> 5 <domain uri="*"/> 6 </allow-from> 7 <grant-to> 8 <socket-resource port="4532" protocol="tcp"/> 9 </grant-to> 10 </policy> 11 </cross-domain-access> 12 </access-policy>
I try to setup the silverlight socket using this following code:
Of course I've tried using the 'Application.Current.Host.Source.DnsSafeHost' instead of "localhost" since all tutorials and guides use it but I haven't been able to find any information about what exactly it contains, when I debug my silverapp. it's set to "" (empty string) which of course throws when inserted into the DnsEndPoint.Code:1 DnsEndPoint endPoint = new DnsEndPoint("localhost", 4532); 2 _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); 3 SocketAsyncEventArgs args = new SocketAsyncEventArgs { RemoteEndPoint = endPoint }; 4 args.Completed += OnSocketConnectCompleted; 5 _socket.ConnectAsync(args);
Finally worth mentioning is that I've checked the traffic using a sniffer and I cannot even catch the silverlight making any localhost requests so I suspect the problem lies in how I setup the DnsEndPoint (or some such).
Any help would be superb, I'm really at the end of my rope.
Edit:
I just found a post regarding the same matter described here:
https://silverlight.net/forums/p/21500/75414.aspx
I did try to change the port to 4530 everywhere, which should be in range, but still no success.


Reply With Quote

Bookmarks