Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble getting sockets to connect in windows7 64bit
    primarykey
    data
    text
    <p>Hey. I've been searching around for a solution to this problem with no luck. I was wondering if this is a known issue when switching socket code from WinXP 32 bit to Win7 64 bit. I have a fairly simple socket routine which works fine in WinXP 32bit, but the socket.connect call is throwing the exception "No connection could be made because the target machine actively refused it 127.0.0.1:48000"</p> <p>I've added an exception to the win7 firewall for the program, and doubled checked to make sure the rule it added was allowing all ports.</p> <p>The code I use to setup these simple sockets is as follows:</p> <p><strong>Listening Socket:</strong></p> <pre><code>byte[] bytes = new Byte[8192]; IPHostEntry ipHostInfo = Dns.GetHostEntry("localhost"); IPAddress ipAddress = ipHostInfo.AddressList[0]; IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 48000); _ListenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { _ListenerSocket.Bind(localEndPoint); _ListenerSocket.Listen(1000); while (_Running) { _ListenerSync.Reset(); _ListenerSocket.BeginAccept(new AsyncCallback(AcceptCallback), _ListenerSocket); _ListenerSync.WaitOne(); } _ListenerSocket.Shutdown(SocketShutdown.Both); _ListenerSocket.Close(); } </code></pre> <p><strong>Connecting Socket:</strong></p> <pre><code>IPAddress _IP; IPAddress.TryParse("127.0.0.1", out _IP) Socket tTarget = null; if (tTarget == null) { tTarget = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); } tTarget.Connect(_IP, 48000); _Connected = true; byte[] tBuffer = new byte[8192]; string tRecvBuff = ""; while (_Connected) { int tRecv = tTarget.Receive(tBuffer); //{ does stuff here } } </code></pre> <p>Seems like everything works until tTarget.Connect(), where it pauses for a second and then throws the exception listed above. AcceptCallback is never called.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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