SharpTox.Core.Tox.AddTcpRelay C# (CSharp) Method

AddTcpRelay() public method

Adds a node as a TCP relay. This method can be used to initiate TCP connections to different ports on the same bootstrap node, or to add TCP relays without using them as bootstrap nodes.
public AddTcpRelay ( ToxNode node ) : bool
node ToxNode The node to add.
return bool
        public bool AddTcpRelay(ToxNode node)
        {
            var error = ToxErrorBootstrap.Ok;
            return AddTcpRelay(node, out error);
        }

Same methods

Tox::AddTcpRelay ( ToxNode node, ToxErrorBootstrap &error ) : bool

Usage Example

コード例 #1
0
ファイル: MiscTests.cs プロジェクト: hexafluoride/Detox
        public void TestToxBootstrapAndConnectTcp()
        {
            var tox = new Tox(new ToxOptions(true, false));
            var error = ToxErrorBootstrap.Ok;

            foreach (var node in Globals.TcpRelays)
            {
                bool result = tox.AddTcpRelay(node, out error);
                if (!result || error != ToxErrorBootstrap.Ok)
                    Assert.Fail("Failed to bootstrap error: {0}, result: {1}", error, result);
            }

            tox.Start();
            while (!tox.IsConnected) { Thread.Sleep(10); }

            Console.WriteLine("Tox connected!");
            tox.Dispose();
        }
All Usage Examples Of SharpTox.Core.Tox::AddTcpRelay