Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting an Access Exception with Multiple PGM Listening Sockets on Non-Admin Account

The following Code works fine for an admin account but for an non admin account it prints success twice then throws an System.Net.Sockets.SocketException (0x80004005): An attempt was made to access a socket in a way forbidden by its access permissions. Anyone have any insight to why this is?

FYI the actual use case here is multiple applications using the same PGM Address and Socket. to push (via multicast) real time updates. This Proof of concept that this isnt caused by our own libraries.

class Program {
    static void Main(string[] args) {

        IPAddress ipAddr = IPAddress.Parse("239.0.0.2");
        IPEndPoint end = new IPEndPoint(ipAddr, 40002);
        Socket[] _sockets = new[] {
            new Socket(AddressFamily.InterNetwork, SocketType.Rdm, (ProtocolType)113 ),
            new Socket(AddressFamily.InterNetwork, SocketType.Rdm, (ProtocolType)113 ),
            new Socket(AddressFamily.InterNetwork, SocketType.Rdm, (ProtocolType)113 )
        };

        foreach (var socket in _sockets)
        {
            socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            socket.Bind(end);
            Console.WriteLine("Success");
        }

        Console.ReadLine();
    }

}

like image 433
Wegged Avatar asked Feb 01 '26 15:02

Wegged


1 Answers

Well I finally got word from Microsoft on this and there is no workaround.

I was able to find the line where your request was denied.

[0] 22E8.1554::08/15/2012-10:05:19.015 [sys] address_c491 PgmCreateAddress() - PgmCreateAddress: ERROR -- Non-admin user trying to open 2+1 handle for IP:Port=

With a little code review, I was able to verify that only three principals are granted access, and they are Administrators, LocalService and NetworkService. Apart from being a member of Administrators, there is no workaround.

I know this wasn’t the answer you wanted to hear, but at least now you have a confirmed answer.

like image 195
Wegged Avatar answered Feb 04 '26 06:02

Wegged



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!