Presentation is loading. Please wait.

Presentation is loading. Please wait.

Сетевое взаимодействие

Similar presentations


Presentation on theme: "Сетевое взаимодействие"— Presentation transcript:

1 Сетевое взаимодействие
11/15/2018 8:27 PM Сетевое взаимодействие Михаил Черномордиков Developer Evangelist, Microsoft Россия © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2 Содержание Взаимодействие JavaScript Класс WebClient
Классы HttpWebRequest/HttpWebResponse Подписка на WCF Web Services Подписка SOAP Web Services Сокеты

3 Класс WebClient Похож на Downloader
Обеспечивает асинхронный кросс-доменный доступ к сетевым ресурсам Простой в использовании: System.Net.WebClient client = new System.Net.WebClient(); client.DownloadStringCompleted+=new DownloadStringCompletedEventHandler(client_DownloadStringCompleted); client.DownloadStringAsync(myURI);

4 demo Web Client http://www.remix.ru 11/15/2018 8:27 PM
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

5 HttpWebRequest / HttpWebResponse
Обеспечивает асинхронный кросс-доменный доступ к сетевым ресурсам Позволяет получить контроль над сообщением HTTP Очень полезный при обращении к существующим основанным на формах (т.e. HTTP-POST) ресурсах, которые активно используются в таких технологиях как PHP

6 Разработка для HTTP Post
Uri uri = new Uri(" HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.BeginGetRequestStream(new AsyncCallback(RequestProceed), request); void RequestProceed(IAsyncResult asyncResult) { } void ResponseProceed(IAsyncResult asyncResult) { }

7 HttpWebRequest and HttpWebResponse
11/15/2018 8:27 PM HttpWebRequest and HttpWebResponse demo © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

8 Подписка на WCF Web Services
Определение сервисов с помощью стандартных контрактов WCF (т.e. [DataMember] и так далее) Использование Visual Studio для создание прокси сервисов (based on HttpWebReq/Resp) Silverlight использует этот прокси асинхронно

9 demo WCF и Silverlight http://www.remix.ru 11/15/2018 8:27 PM
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

10 Подписка на SOAP Web Services
Веб-сервисы должны предоставлять файл WSDL и сервер должен иметь crossdomain.xml или clientaccesspolicy.xml, правильно настроенный и расположенный Использование Visual Studio для создания прокси сервиса (основано на HttpWebReq/Resp) Silverlight использует этот прокси асинхронно

11 Поддержка сокетов В Silverlight возможно сетевое взаимодействие на базе сокетов Ограничения Поддерживаются только порты из диапазона Коммуникация возможна только с тем же доменом, на котором находится элемент управления Необходим полиси-сервер, расположенный на порту 943 До инициализации соединения Silverlight опрашивает порт 943 для получения информации о полиси, которая содержит разрешенные порты и протоколы

12 demo Sockets http://www.remix.ru 11/15/2018 8:27 PM
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

13 Сетевое взаимодействие
11/15/2018 8:27 PM Сетевое взаимодействие Михаил Черномордиков Developer Evangelist, Microsoft Россия © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Download ppt "Сетевое взаимодействие"

Similar presentations


Ads by Google