somdoron / AsyncIO

Mozilla Public License 2.0
174 stars 58 forks source link

Exception when connecting UDP sockets #39

Open dxdjgl opened 4 years ago

dxdjgl commented 4 years ago

@somdoron is this expected? Below code throws excetion.

static void Main(string[] args) { var s = AsyncSocket.Create(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); s.Bind(IPAddress.Parse("127.0.0.1"), 27000);

        var c = AsyncSocket.Create(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
        c.Connect(IPAddress.Parse("127.0.0.1"), 27000);
    }

Unhandled Exception: System.Net.Sockets.SocketException: An invalid argument was supplied at AsyncIO.Windows.Socket.Connect(IPEndPoint endPoint) in D:\Repo\AsyncIO\Source\AsyncIO\Windows\Socket.cs:line 440 at AsyncIO.SocketExtensions.Connect(AsyncSocket socket, IPAddress ipAddress, Int32 port) in D:\Repo\AsyncIO\Source\AsyncIO\SocketExtensions.cs:line 19 at udptest.Program.Main(String[] args) in D:\Repo\dxdjglnetmqudp\src\udptest\Program.cs:line 22 Press any key to continue . . .

wmjordan commented 4 years ago

As far as I know, UDP is not supported.

dxdjgl commented 4 years ago

Would it not make sense to add support for UDP because of NetMQ for example?

wmjordan commented 4 years ago

I think it makes sense. I'd previously posted the same request years ago.

However, UDP is a different thing. It might require some considerable amount of efforts to incorporate it into NetMQ. @somdoron might think so too.