Closed bc closed 3 years ago
I added this line above the Coroutine just now:
AsyncIO.ForceDotNet.Force();
and it now works.
However, when I try the same thing on my Task-based approach, I get a new error:
Parameter name: socket
AsyncIO.Windows.CompletionPort.AssociateSocket (AsyncIO.AsyncSocket socket, System.Object state) (at <3c72113274de4b3face0e2579126a901>:0)
NetMQ.Core.Utils.Proactor.AddSocket (AsyncIO.AsyncSocket socket, NetMQ.Core.IProactorEvents proactorEvents) (at <21696b85a92a4a0eb8332ff57aebfd69>:0)
NetMQ.Core.IOObject.AddSocket (AsyncIO.AsyncSocket socket) (at <21696b85a92a4a0eb8332ff57aebfd69>:0)
NetMQ.Core.Transports.Tcp.TcpConnector.StartConnecting () (at <21696b85a92a4a0eb8332ff57aebfd69>:0)
NetMQ.Core.Transports.Tcp.TcpConnector.ProcessPlug () (at <21696b85a92a4a0eb8332ff57aebfd69>:0)
NetMQ.Core.ZObject.ProcessCommand (NetMQ.Core.Command cmd) (at <21696b85a92a4a0eb8332ff57aebfd69>:0)
NetMQ.Core.IOThread.Ready () (at <21696b85a92a4a0eb8332ff57aebfd69>:0)
NetMQ.Core.IOThreadMailbox.RaiseEvent () (at <21696b85a92a4a0eb8332ff57aebfd69>:0)
NetMQ.Core.Utils.Proactor.Loop () (at <21696b85a92a4a0eb8332ff57aebfd69>:0)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Threading.ThreadHelper.ThreadStart () (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)```
apologies, first line of err msg got cut off: it's ArgumentException: socket must be of type Windows.Socket
This issue has been automatically marked as stale because it has not had activity for 365 days. It will be closed if no further activity occurs within 56 days. Thank you for your contributions.
I was getting the same ArgumentException: socket must be of type Windows.Socket
I found that calling ForceDotNet.Force();
before using netmq seemed to work around the issue.
I was also having a socket issue on Windows, but not Mac. I had moved my socket creation out of a using declaration so I could catch exceptions. I needed to call ForceDotNet.Force() before the socket was created instead of in the listener thread. The old order still works on Mac, but stopped working on Windows for some reason. Thanks for this clue!
Environment
Expected behaviour
I want to build a C# DealerSocket and connect it to a Router at a known external address. I want to send messages to the Router frequently, and leave the Dealer up for the entire game.
Actual behaviour
On Mac, 0 error, works perfectly. On PC: I get this error message, and the dealer is prevented from sending messages
Steps to reproduce the behaviour
code for the Dealer (no other dependencies in the project)
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net.Sockets; using System.Threading; using NetMQ; using NetMQ.Sockets; using UnityEngine;
public class TestCoroutine : MonoBehaviour { private bool _dealerCancelled; private IEnumerator _dealerWorkerRoutine; public Queue OutBox = new Queue();
public Queue Inbox = new Queue();
public List pings = new List();
private DealerSocket _sock;
public delegate void SocketDel();