Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try:</p> <pre><code>private static DnsEndPoint IP_END_POINT = new DnsEndPoint("192.168.0.36", 4525, AddressFamily.InterNetwork); public MainPage() { try { InitializeComponent(); socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); SocketAsyncEventArgs connectEventArgs = new SocketAsyncEventArgs(); connectEventArgs.RemoteEndPoint = IP_END_POINT; connectEventArgs.Completed += new EventHandler&lt;SocketAsyncEventArgs&gt;(ConnectionEstablished); if(!socket.ConnectAsync(connectEventArgs)) { ConnectionEstablished(/*Insert Args*/); //Handle real time execution } } catch (Exception e) { //write error somewhere } } </code></pre> <p>The <a href="http://msdn.microsoft.com/en-us/library/bb538102%28v=vs.95%29.aspx" rel="nofollow">documentation</a> indicates if <code>ConnectAsync</code> returns false then "The SocketAsyncEventArgs.Completed event on the System.Net.Sockets.SocketAsyncEventArgs object passed in the e parameter will not be raised."</p> <p>Also, make sure you are logging the exception somewhere. There might be an exception which you are just breezing past.</p> <p><strong>Update</strong>:</p> <ul> <li>Did you check the <a href="http://msdn.microsoft.com/en-us/library/cc645032%28v=vs.95%29.aspx" rel="nofollow">ClientAccessPolicy.xml</a> file? You would need to replace all the “ and ” characters with ".</li> <li>Have you tried adding <code>connectEventArgs.UserToken = socket;</code> before the <code>ConnectAsync(connectEventArgs)</code> call?</li> <li>Is the server receiving the request and sending a reply (may require the use of <a href="http://www.wireshark.org/download.html" rel="nofollow">Wireshark</a> on the client)?</li> <li>While debugging does <code>connectEventArgs.Completed</code> point to the correct method?</li> <li>While debugging, what happens if you "Step Over" (F10) until the method returns? Are other methods called?</li> <li>While debugging, if you "Step Over" (F10) <code>socket.ConnectAsync(connectEventArgs)</code> (but are still in the method) are there other threads in the Debug>Windows>Threads window? What happens if you switch to the other thread (right click on thread and select "Switch To Thread" or double click the thread)?</li> </ul> <p>Let me know how things turn out.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload