Description





Description

[Note: The transportType enumeration defines transport types for the SocketPermission and System.Net.Sockets.Socket classes.]

Example
using System;

using System.Net;

using System.Security;

using System.Security.Permissions;

using System.Collections;



public class TransportTypeSample

{

    public static void Main()

    {

        SocketPermission perm = new SocketPermission(

            NetworkAccess.Connect,

            TransportType.Tcp,

            "microsoft.com", 80);

        IEnumerator list = perm.ConnectList;

        while(list.MoveNext())

        {

            Console.Write("ConnectList: '{0}' ",list.Current);

            EndpointPermission epp = (EndpointPermission) list.Current;

            Console.WriteLine("TransportType='{0}'", epp.Transport);

        }

        Console.WriteLine("XML encoding of SocketPermission:");

        SecurityElement sec = perm.ToXml();

        Console.WriteLine(sec);

        Console.WriteLine();

        Console.WriteLine();

        Console.WriteLine("Press Enter to continue");

        Console.ReadLine();

    }

}


The output is

ConnectList: 'microsoft.com#80#2' TransportType='Tcp'

XML encoding of SocketPermission:

<IPermission class="System.Net.SocketPermission, System, Version=1.0.5000.0, 

Culture=neutral, PublicKeyToken=b77a5c561934e089"

             version="1">

   <ConnectAccess>

      <ENDPOINT host="microsoft.com"

                transport="Tcp"

                port="80"/>

   </ConnectAccess>

</IPermission>







Press Enter to continue



     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows