My question is virtually identical to mono/linux socket denied? but it doesn’t seem that question was ever properly answered so I’m 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 try to start up 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’m trying to bind to a port above 1024 (specifically 12345 in this case) so that’s not the issue. I’m not running AppArmor or SELinux or anything like that. The port is not in use on my system. My user is a member of the “network” group if it matters. My program will bind to the socket if I run it with sudo but that’s not an ideal case obviously.
Here’s the code I use to create the 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 being passed as “port” and “192.168.0.11” (my local IP) is being passed as “host”. I’ve also tried IPAddress.Any to no avail.
Alchemy throws up a Flash Policy file at 843 – try turning off the flashsocketpolicy when instantiating your server.