I'm currently have a test project made up with C#. Basically it makes a TCP Listener socket. but it makes an error if i try to accept connection.
socket_tcpListener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket_tcpListener.Bind(endPoint); socket_tcpListener.Listen(28); socket_tcpListener.Accept();
above code is exactly what i've done. it was completely fine when i ran this compiled .exe on window. an it was also find when i've ran this project without compile using 'dotnet run' command. but if i compile the project to .dll file using 'dotnet msbuild' command and run with 'dotnet run' command, it make errors.
System.Net.Sockets.SocketException (0x80004005): Operation on non-blocking socket would block
I've logged each line to find out exact position making error. so i found Accept method in last line occurs error.
disable blocking(socket.Blocking = false) didn't help. and the I don't really know why, only compiled dll make error. need help.
User contributions licensed under CC BY-SA 3.0