My question is almost identical to mono / linux socket denied? but it seems that this question did not answer properly, so I am still stuck.
I have a server written using Alchemy WebSockets. I had it working fine on Windows, but after porting it to Linux, I can't get it to work. I get the following error every time I start the socket server:
System.Net.Sockets.SocketException: Access denied at System.Net.Sockets.Socket.Bind (System.Net.EndPoint local_end) [0x00051] in /build/src/mono-2.10.8/mcs/class/System/System.Net.Sockets/Socket.cs:1104 at System.Net.Sockets.TcpListener.Start (Int32 backlog) [0x00022] in /build/src/mono-2.10.8/mcs/class/System/System.Net.Sockets/TcpListener.cs:268 at System.Net.Sockets.TcpListener.Start () [0x00000] in /build/src/mono-2.10.8/mcs/class/System/System.Net.Sockets/TcpListener.cs:243 at Alchemy.TcpServer.Listen (System.Object state) [0x00000] in <filename unknown>:0
I am trying to bind to a port above 1024 (in this case 12345), so this is not a problem. I do not start AppArmor or SELinux or something like that. The port is not used on my system. My user is a member of the network group, if that matters. My program will communicate with the socket if I run it using sudo, but this is not an ideal case.
Here is the code I use to create a socket and start listening:
static public void Start(int port, string host) { _server = new WebSocketServer(port, IPAddress.Parse(host)); _server.OnConnect = OnConnected; _server.OnDisconnect = OnDisconnect; _server.Start(); }
โ12345โ is transmitted as โportโ and โ192.168.0.11โ (my local IP) is transmitted as โhostโ. I also tried IPAddress.Any to no avail.
source share