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


C# Service.Send方法代码示例

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


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

示例1: AppBuilderViewModel

 public AppBuilderViewModel(Service service)
 {
     Service = service;
     availableCodeProjectsWithContentProjects = new Dictionary<ProjectEntry, string>();
     MessagesListViewModel = new AppBuildMessagesListViewModel();
     AppListViewModel = new BuiltAppsListViewModel(Settings.Current);
     AppListViewModel.RebuildRequest += OnAppRebuildRequest;
     BuildCommand = new RelayCommand(OnBuildExecuted, () => IsBuildActionExecutable);
     HelpCommand = new RelayCommand(OpenAppBuilderFeaturesPage);
     GotoUserProfilePageCommand = new RelayCommand(OpenUserProfilePage);
     GotoBuiltAppsDirectoryCommand = new RelayCommand(OpenLocalBuiltAppsDirectory);
     service.AvailableProjectsChanged += OnAvailableProjectsChanged;
     OnAvailableProjectsChanged();
     service.ProjectChanged += OnContentProjectChanged;
     OnContentProjectChanged();
     service.DataReceived += OnServiceMessageReceived;
     Service.Send(new SupportedPlatformsRequest());
     SelectedPlatform = PlatformName.Windows;
     IsRebuildForced = false;
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:20,代码来源:AppBuilderViewModel.cs

示例2: _SendRecvTest

    private void _SendRecvTest()
    {
        Console.WriteLine("Send/Recv test:");
        using (Service svc = new Service("SendRecvTest"))
        {
            svc.Start();

            IPEndPoint ep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 7788);
            int listenSessionId = svc.Listen(ep);
            Console.WriteLine("Listened on [{0}], sessionId: {1}", ep, listenSessionId);

            int connSessionId = svc.Connect(ep);
            Console.WriteLine("Connected to {0}, sessionId: {1}", ep, connSessionId);

            // Test Send
            TestPacket data = new TestPacket();
            data.intVal = 10086;
            data.strVal = "Hello World";
            svc.Send(connSessionId, data);

            // Test Multicast
            TestMulticastPacket multicastData = new TestMulticastPacket();
            multicastData.intVal = 10010;
            multicastData.strVal = "Multicast data";
            List<int> multicastSessionIds = new List<int>();
            multicastSessionIds.Add(connSessionId);
            svc.Multicast(multicastSessionIds, multicastData);

            // Test Broadcast
            TestBroadcastPacket broadcastData = new TestBroadcastPacket();
            broadcastData.intVal = 8888;
            broadcastData.strVal = "Broadcast data";
            svc.Broadcast(broadcastData);

            // Test unhandled packet
            svc.Send(connSessionId, new UnHandledPacket());

            // Test coder not found
            MemoryStream unhandledStream = new MemoryStream();
            unhandledStream.Write(new byte[30], 0, 30);
            svc.Send(connSessionId, 10086, unhandledStream);

            Console.WriteLine("Press any key to exit Send/Recv test...");
            Console.ReadKey();
        }
    }
开发者ID:lailongwei,项目名称:llbc,代码行数:46,代码来源:TestCase_Comm_Service.cs

示例3: _PreHandleTest

    private void _PreHandleTest()
    {
        Console.WriteLine("PreHandle test:");
        using (Service svc = new Service("PreHandleTest"))
        {
            svc.Start();

            IPEndPoint ep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 7788);
            Console.WriteLine("Listened on {0}", ep);

            int connSessionId = svc.Connect(ep);
            Console.WriteLine("Connected to {0}, sessionId: {1}", ep, connSessionId);

            TestPacket data = new TestPacket();
            data.intVal = 10086;
            data.strVal = "Hello World";
            svc.Send(connSessionId, data);

            Console.WriteLine("Press any key to exit PreHandle test...");
            Console.ReadKey();
        }
    }
开发者ID:lailongwei,项目名称:llbc,代码行数:22,代码来源:TestCase_Comm_Service.cs


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