DBus.Transports.SocketTransport.Open C# (CSharp) Method

Open() public method

public Open ( AddressEntry entry ) : void
entry AddressEntry
return void
		public override void Open (AddressEntry entry)
		{
			string host, portStr, family;
			int port;

			if (!entry.Properties.TryGetValue ("host", out host))
				host = "localhost";

			if (!entry.Properties.TryGetValue ("port", out portStr))
				throw new Exception ("No port specified");

			if (!Int32.TryParse (portStr, out port))
				throw new Exception ("Invalid port: \"" + port + "\"");

			if (!entry.Properties.TryGetValue ("family", out family))
				family = null;

			Open (host, port, family);
		}

Same methods

SocketTransport::Open ( Socket socket ) : void
SocketTransport::Open ( string host, int port, string family ) : void

Usage Example

Exemplo n.º 1
0
 public static Transport Create(AddressEntry entry)
 {
     switch (entry.Method) {
         case "tcp":
         {
             Transport transport = new SocketTransport ();
             transport.Open (entry);
             return transport;
         }
     #if !PORTABLE
         case "unix":
         {
             Transport transport = new UnixNativeTransport ();
             transport.Open (entry);
             return transport;
         }
     #endif
     #if ENABLE_PIPES
         case "win": {
             Transport transport = new PipeTransport ();
             transport.Open (entry);
             return transport;
         }
     #endif
         default:
             throw new NotSupportedException ("Transport method \"" + entry.Method + "\" not supported");
     }
 }
All Usage Examples Of DBus.Transports.SocketTransport::Open