当前位置: 首页>>代码示例>>C#>>正文


C# ClientConfiguration.setTcpTransport方法代码示例

本文整理汇总了C#中ClientConfiguration.setTcpTransport方法的典型用法代码示例。如果您正苦于以下问题:C# ClientConfiguration.setTcpTransport方法的具体用法?C# ClientConfiguration.setTcpTransport怎么用?C# ClientConfiguration.setTcpTransport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClientConfiguration的用法示例。


在下文中一共展示了ClientConfiguration.setTcpTransport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: doCreateSession

        /**
         * Creates <em>most</em> everything needed for a tutorial session; the Account instance is populated during sign-in.
         *
         * @param tutorialTag
         *  The tutorial's class name. If null or the empty string, default it to <code>T_TAG_DFLT</code>.
         * @param accountName
         *  The <em>name</em> of the account to use for this tutorial. If null or the empty string,
         *  <em>fail</em> by throwing a RuntimeException indicating that fact.
         * @param pathName
         * 	Pathname of the certificate file, which should be a PEM file.
         *
         * @return
         * <ul>
         *   <li>true: session initialized</li>
         *   <li>false: session initialization failed due to:
         *   	<ul>
         *   		<li>no or empty account name</li>
         *   		<li>com.skype.api.Skype.Init failed - most likely from an invalid AppKeyPair</li>
         *   		<li>could not obtain an Account instance</li>
         *   	</ul>
         *   </li>
         * </ul>
         *
         * @see com.skype.tutorial.util.SignInMgr
         *
         * @since 1.0
         */
        /*	public boolean doCreateSession(String tutorialTag, String accountName, AppKeyPairMgr myAppKeyPairMgr) {
        */
        public bool doCreateSession(String tutorialTag, String accountName, String pathName)
        {
            if ((tutorialTag != null) && (tutorialTag.Length != 0))
            {
                myTutorialTag = tutorialTag;
            }
            else
            {
                myTutorialTag = T_TAG_DFLT;
            }

            if ((accountName != null) && (accountName.Length != 0))
            {
                myAccountName = accountName; // All tutorials minimally require an account name
            }
            else
            {
                throw new Exception((myTutorialTag + ": Cannot initialize session instance - no account name!"));
            }

            // Set up our session with the SkypeKit runtime...
            // Note that most of the Skype methods - including static methods and GetVersionString - will
            // fail and/or throw an exception if invoked prior to successful initialization!
            mySkype = new Skype();
            myClientConfiguration = new ClientConfiguration();
            myClientConfiguration.setTcpTransport(IP_ADDR, PORT_NUM);
            myClientConfiguration.setCertificate(pathName);
            myListeners = new Listeners(this);
            myConsole.printf("%s: Instantiated Skype, ClientConfiguration, and Listeners instances...%n", myTutorialTag);

            mySkype.init(myClientConfiguration, myListeners);
            mySkype.start(); // You must invoke start --immediately-- after invoking init!

            myParseSkypeKitVersion = new ParseSkypeKitVersion(mySkype);
            myConsole.printf("%s: Initialized MySkype instance - version = %s (%d.%d.%d)%n",
                        myTutorialTag, myParseSkypeKitVersion.getVersionStr(),
                        myParseSkypeKitVersion.getMajorVersion(),
                        myParseSkypeKitVersion.getMinorVersion(),
                        myParseSkypeKitVersion.getPatchVersion());

            // Get the Account
            if ((myAccount = mySkype.getAccount(myAccountName)) == null)
            {
                myConsole.printf("%s: Could not get Account for %s!%n", myTutorialTag, myAccountName);
                myConsole.printf("%s: Session initialization failed!%n", myTutorialTag);
                return (false);
            }

            myConsole.printf("%s: Got Account for %s%n", myTutorialTag, myAccountName);
            myConsole.printf("%s: Initialized session!%n", myTutorialTag);

            return (true);
        }
开发者ID:ravurivasu,项目名称:Skype-Examples,代码行数:82,代码来源:MySession.cs


注:本文中的ClientConfiguration.setTcpTransport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。