Csharp/CSharp Tutorial/Network/SocketPermission

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Minimum permission request for SocketPermission

using System;
using System.Net;
using System.Security.Permissions;

[assembly: SocketPermission(SecurityAction.RequestMinimum, Unrestricted = true)]
class MainClass
{
    public static void Main()
    {
    }
}

SocketPermission that allows the code to open a TCP connection to the specified host and port

using System;
using System.Net;
using System.Security.Permissions;
[assembly:SocketPermission(SecurityAction.RequestMinimum, Access = "Connect", Host = "www.nfex.ru", Port = "9999", Transport = "Tcp")]
class MainClass
{
    public static void Main()
    {        
    }
}