SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Socket
Siverlight for Windows Phone

            Silverlight     in⼤大   #19

     (Microsoft MVP for Windows Phone)
⾃自⼰己
• 
• 
     –         iPhone / Android
     –         Windows Phone
     – 
          •  EbIRC (WM5/6)
          •  ZEROProxy (WM5/6)
          •  Giraffe (WM5/6)
          •  SongTweeter (WP7)
• 
               ⽤用    ⽤用
•         ⻄西                  ⽉月


•                   ⼟土
     ⼤大                  ⼤大

     – 
     – 
     – 
•  Windows Phone “Mango” Socket
•       Windows Mobile 6.x
   .NET Compact Framework

     –  ⾮非


•                     ⽻羽⽬目
•            Socket
•  .NET Fx Silverlight Socket
• 
     – 
     – 
• 
.NET Fx Silverlight Socket
•  .NET Fx Silverlight for Windows Phone
            System.Net.Socket
• 

•  Silverlight Socket
  –  NetworkStream
     •    StreamReader
     •                   ⼿手
  –  SslStream
     SSL       (              )
.NET Framework                                Socket




public IAsyncResult BeginReceive(byte[ ] buffer, int offset, int size, SocketFlags
socketFlags, out SocketError errorCode, AsyncCallback callback, object state)




                                   Begin- / End-    IAsyncResult
Silverlight for WP                     Socket




     public bool ReceiveAsync(SocketAsyncEventArgs e)




                      (        )   2    EventArgs     ⾮非
                          ⾮非           ⼊入           true
• 
     –                   Socket

          • 

          • 


•                           ⼊入
     –  .NET Framework
        ⾚赤
•  .NET Framework
m_socket = new Socket(AddressFamily.InterNetwork,
                      SocketType.Stream, ProtocolType.Tcp);
m_connectAsync = m_socket.BeginConnect(remoteEndPoint,
                        new AsyncCallback(OnConnected), m_socket);

protected void OnConnected(IAsyncResult ar)
{
  try
  {
      //
      // (               EndConnect          SocketException         )
      Socket socket = (Socket)ar.AsyncState;
       socket.EndConnect(ar);



                IAsyncResult
•  Silverlight for Windows Phone
SocketAsyncEventArgs eargs = new SocketAsyncEventArgs();
eargs.RemoteEndPoint = remoteEndPoint;
eargs.Completed +=
             new EventHandler<SocketAsyncEventArgs>(ConnectCompleted);

m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
                              ProtocolType.Tcp);       EventArgs
if (!m_socket.ConnectAsync(eargs))
{
       //                            	
 
	
 	
 	
 	
 ConnectCompleted(m_socket, eargs);
}


                                             ⾃自
•  .NET Framework
m_stream = new NetworkStream(socket);
m_reader = new StreamReader(m_stream, this.Encoding);
while (true)
{
  string line =m_reader.ReadLine();
  --           --
}
                               NetworkStream




 StreamReader            1   ⾏行行
•  Silverlight for Windows Phone
  m_receiveBuffer = new byte[2048];
	
 
SocketAsyncEventArgs e = new SocketAsyncEventArgs();
e.SetBuffer(m_receiveBuffer, 0, m_receiveBuffer.Length);
e.Completed +=
             new EventHandler<SocketAsyncEventArgs>(ReceiveCompleted);
	
 
m_socket.ReceiveAsync(e);


                                    ⾃自
•  Silverlight for Windows Phone
void ReceiveCompleted(object sender, SocketAsyncEventArgs e)
{
      if (e.SocketError == SocketError.Success)
      {
 	
 	
 	
 	
 	
 	
 	
 if (e.BytesTransferred > 0)
             {                                            ⾃自
                   // snip                           ⾃自
             }
             if (!m_sendLoopStop)
                   Receive();
                                              ⾃自  BeginReceive
      }
      else
      {
             ProcessSocketError(e.SocketError);
      }
}
•  .NET Compact Framework

• 
     – 
     –               ⽕火
• 
     – 
           •  DnsEndPoint

     – 
     –                     (Control.Invoke/
          Dispatcher.Invoke)
Demo
• 
•  Socket
     –  Background Agent             ⾏行行

        •  Socket             ⽤用
     –  IRC
        •                                  IRC
        •  IRC                                   Toast
        •  iOS4     Long-time Task     ⾔言

•                                    UX
     –                         ⾃自
     –  ⼀一                 (pirc            )

Contenu connexe

Tendances

Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#Mauricio Velazco
 
Nsa and vpn
Nsa and vpnNsa and vpn
Nsa and vpnantitree
 
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru OtsukaTake a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru OtsukaCODE BLUE
 
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...Alexandre Moneger
 
Scapy TLS: A scriptable TLS 1.3 stack
Scapy TLS: A scriptable TLS 1.3 stackScapy TLS: A scriptable TLS 1.3 stack
Scapy TLS: A scriptable TLS 1.3 stackAlexandre Moneger
 
HTTPプロクシライブラリproxy2の設計と実装
HTTPプロクシライブラリproxy2の設計と実装HTTPプロクシライブラリproxy2の設計と実装
HTTPプロクシライブラリproxy2の設計と実装inaz2
 
Penetration Testing Resource Guide
Penetration Testing Resource Guide Penetration Testing Resource Guide
Penetration Testing Resource Guide Bishop Fox
 
Pentesting custom TLS stacks
Pentesting custom TLS stacksPentesting custom TLS stacks
Pentesting custom TLS stacksAlexandre Moneger
 
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...CODE BLUE
 
Docker Security
Docker SecurityDocker Security
Docker Securityantitree
 
Csw2016 d antoine_automatic_exploitgeneration
Csw2016 d antoine_automatic_exploitgenerationCsw2016 d antoine_automatic_exploitgeneration
Csw2016 d antoine_automatic_exploitgenerationCanSecWest
 
SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005James Morris
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programmingkozossakai
 
How Safe is your Link ?
How Safe is your Link ?How Safe is your Link ?
How Safe is your Link ?Peter Hlavaty
 
Vm ware fuzzing - defcon russia 20
Vm ware fuzzing  - defcon russia 20Vm ware fuzzing  - defcon russia 20
Vm ware fuzzing - defcon russia 20DefconRussia
 
Ubuntu: Setup development environment for ruby on rails
Ubuntu:  Setup development environment for ruby on railsUbuntu:  Setup development environment for ruby on rails
Ubuntu: Setup development environment for ruby on railsGanesh Kunwar
 
BlueHat v18 || The matrix has you - protecting linux using deception
BlueHat v18 || The matrix has you - protecting linux using deceptionBlueHat v18 || The matrix has you - protecting linux using deception
BlueHat v18 || The matrix has you - protecting linux using deceptionBlueHat Security Conference
 
Ch 5: Port Scanning
Ch 5: Port ScanningCh 5: Port Scanning
Ch 5: Port ScanningSam Bowne
 
Loophole: Timing Attacks on Shared Event Loops in Chrome
Loophole: Timing Attacks on Shared Event Loops in ChromeLoophole: Timing Attacks on Shared Event Loops in Chrome
Loophole: Timing Attacks on Shared Event Loops in Chromecgvwzq
 
Assume Compromise
Assume CompromiseAssume Compromise
Assume CompromiseZach Grace
 

Tendances (20)

Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#
 
Nsa and vpn
Nsa and vpnNsa and vpn
Nsa and vpn
 
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru OtsukaTake a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
 
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
 
Scapy TLS: A scriptable TLS 1.3 stack
Scapy TLS: A scriptable TLS 1.3 stackScapy TLS: A scriptable TLS 1.3 stack
Scapy TLS: A scriptable TLS 1.3 stack
 
HTTPプロクシライブラリproxy2の設計と実装
HTTPプロクシライブラリproxy2の設計と実装HTTPプロクシライブラリproxy2の設計と実装
HTTPプロクシライブラリproxy2の設計と実装
 
Penetration Testing Resource Guide
Penetration Testing Resource Guide Penetration Testing Resource Guide
Penetration Testing Resource Guide
 
Pentesting custom TLS stacks
Pentesting custom TLS stacksPentesting custom TLS stacks
Pentesting custom TLS stacks
 
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
 
Docker Security
Docker SecurityDocker Security
Docker Security
 
Csw2016 d antoine_automatic_exploitgeneration
Csw2016 d antoine_automatic_exploitgenerationCsw2016 d antoine_automatic_exploitgeneration
Csw2016 d antoine_automatic_exploitgeneration
 
SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programming
 
How Safe is your Link ?
How Safe is your Link ?How Safe is your Link ?
How Safe is your Link ?
 
Vm ware fuzzing - defcon russia 20
Vm ware fuzzing  - defcon russia 20Vm ware fuzzing  - defcon russia 20
Vm ware fuzzing - defcon russia 20
 
Ubuntu: Setup development environment for ruby on rails
Ubuntu:  Setup development environment for ruby on railsUbuntu:  Setup development environment for ruby on rails
Ubuntu: Setup development environment for ruby on rails
 
BlueHat v18 || The matrix has you - protecting linux using deception
BlueHat v18 || The matrix has you - protecting linux using deceptionBlueHat v18 || The matrix has you - protecting linux using deception
BlueHat v18 || The matrix has you - protecting linux using deception
 
Ch 5: Port Scanning
Ch 5: Port ScanningCh 5: Port Scanning
Ch 5: Port Scanning
 
Loophole: Timing Attacks on Shared Event Loops in Chrome
Loophole: Timing Attacks on Shared Event Loops in ChromeLoophole: Timing Attacks on Shared Event Loops in Chrome
Loophole: Timing Attacks on Shared Event Loops in Chrome
 
Assume Compromise
Assume CompromiseAssume Compromise
Assume Compromise
 

Similaire à Socketプログラム Silverlight for Windows Phoneへの移植のポイント

Building an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent ConnectionsBuilding an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent Connections Renaun Erickson
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server InternalsPraveen Gollakota
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsSerge Stinckwich
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSocketsGonzalo Ayuso
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the wayOleg Podsechin
 
Going real time with Socket.io
Going real time with Socket.ioGoing real time with Socket.io
Going real time with Socket.ioArnout Kazemier
 
Lecture 6 Web Sockets
Lecture 6   Web SocketsLecture 6   Web Sockets
Lecture 6 Web SocketsFahad Golra
 
04 android
04 android04 android
04 androidguru472
 
An Introduction to Twisted
An Introduction to TwistedAn Introduction to Twisted
An Introduction to Twistedsdsern
 
Jugando con websockets en nodeJS
Jugando con websockets en nodeJSJugando con websockets en nodeJS
Jugando con websockets en nodeJSIsrael Gutiérrez
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineRicardo Silva
 
Networking.ppt(client/server, socket) uses in program
Networking.ppt(client/server, socket) uses in programNetworking.ppt(client/server, socket) uses in program
Networking.ppt(client/server, socket) uses in programgovindjha339843
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioRick Copeland
 
Comunicando nuestras apps con el mundo exterior
Comunicando nuestras apps con el mundo exteriorComunicando nuestras apps con el mundo exterior
Comunicando nuestras apps con el mundo exteriorRoberto Luis Bisbé
 
Nodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredevNodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredevFelix Geisendörfer
 

Similaire à Socketプログラム Silverlight for Windows Phoneへの移植のポイント (20)

Building an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent ConnectionsBuilding an ActionScript Game Server with over 15,000 Concurrent Connections
Building an ActionScript Game Server with over 15,000 Concurrent Connections
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server Internals
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Using Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systemsUsing Smalltalk for controlling robotics systems
Using Smalltalk for controlling robotics systems
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
分散式系統
分散式系統分散式系統
分散式系統
 
Cp7 rpc
Cp7 rpcCp7 rpc
Cp7 rpc
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the way
 
Socket & Server Socket
Socket & Server SocketSocket & Server Socket
Socket & Server Socket
 
Going real time with Socket.io
Going real time with Socket.ioGoing real time with Socket.io
Going real time with Socket.io
 
Lecture 6 Web Sockets
Lecture 6   Web SocketsLecture 6   Web Sockets
Lecture 6 Web Sockets
 
04 android
04 android04 android
04 android
 
An Introduction to Twisted
An Introduction to TwistedAn Introduction to Twisted
An Introduction to Twisted
 
Jugando con websockets en nodeJS
Jugando con websockets en nodeJSJugando con websockets en nodeJS
Jugando con websockets en nodeJS
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
Networking.ppt(client/server, socket) uses in program
Networking.ppt(client/server, socket) uses in programNetworking.ppt(client/server, socket) uses in program
Networking.ppt(client/server, socket) uses in program
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.io
 
Comunicando nuestras apps con el mundo exterior
Comunicando nuestras apps con el mundo exteriorComunicando nuestras apps con el mundo exterior
Comunicando nuestras apps con el mundo exterior
 
Nodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredevNodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredev
 

Plus de Shin Ise

Cross platform development with Xamarin 2.0 + MvvmCross
Cross platform development with Xamarin 2.0 + MvvmCrossCross platform development with Xamarin 2.0 + MvvmCross
Cross platform development with Xamarin 2.0 + MvvmCrossShin Ise
 
いまどきのiOSプログラミング with Xcode5
いまどきのiOSプログラミング with Xcode5いまどきのiOSプログラミング with Xcode5
いまどきのiOSプログラミング with Xcode5Shin Ise
 
すまべんLite@関西#4
すまべんLite@関西#4すまべんLite@関西#4
すまべんLite@関西#4Shin Ise
 
すまべんLite@関西#3
すまべんLite@関西#3すまべんLite@関西#3
すまべんLite@関西#3Shin Ise
 
すまべんLite@関西#2
すまべんLite@関西#2すまべんLite@関西#2
すまべんLite@関西#2Shin Ise
 
すごいHaskell読書会#10
すごいHaskell読書会#10すごいHaskell読書会#10
すごいHaskell読書会#10Shin Ise
 
音声APIを使ってみる
音声APIを使ってみる音声APIを使ってみる
音声APIを使ってみるShin Ise
 
すまべんLite@関西#1
すまべんLite@関西#1すまべんLite@関西#1
すまべんLite@関西#1Shin Ise
 
Xamarin2.0であそぼう
Xamarin2.0であそぼうXamarin2.0であそぼう
Xamarin2.0であそぼうShin Ise
 
CoreBluetoothでつくるBluetooth Low Energyデバイス
CoreBluetoothでつくるBluetooth Low EnergyデバイスCoreBluetoothでつくるBluetooth Low Energyデバイス
CoreBluetoothでつくるBluetooth Low EnergyデバイスShin Ise
 
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」Shin Ise
 
GridViewのつかいかた
GridViewのつかいかたGridViewのつかいかた
GridViewのつかいかたShin Ise
 
iOSのVoiceOver対応開発 Rev2
iOSのVoiceOver対応開発 Rev2iOSのVoiceOver対応開発 Rev2
iOSのVoiceOver対応開発 Rev2Shin Ise
 
MediaLibrary で あそぼう
MediaLibrary で あそぼうMediaLibrary で あそぼう
MediaLibrary で あそぼうShin Ise
 
実践 Reactive Extensions
実践 Reactive Extensions実践 Reactive Extensions
実践 Reactive ExtensionsShin Ise
 
本当は怖いSilverlight for Windows Phone Toolkit
本当は怖いSilverlight for Windows Phone Toolkit本当は怖いSilverlight for Windows Phone Toolkit
本当は怖いSilverlight for Windows Phone ToolkitShin Ise
 
Macで使うWindows Phone 7
Macで使うWindows Phone 7Macで使うWindows Phone 7
Macで使うWindows Phone 7Shin Ise
 
iOSのVoiceOver対応開発
iOSのVoiceOver対応開発iOSのVoiceOver対応開発
iOSのVoiceOver対応開発Shin Ise
 
Galaxy tab で持ち歩くモバイルサーバー
Galaxy tab で持ち歩くモバイルサーバーGalaxy tab で持ち歩くモバイルサーバー
Galaxy tab で持ち歩くモバイルサーバーShin Ise
 
ハブインテグレーションでWindows Phone 7の世界に溶け込むアプリを作る
ハブインテグレーションでWindows Phone 7の世界に溶け込むアプリを作るハブインテグレーションでWindows Phone 7の世界に溶け込むアプリを作る
ハブインテグレーションでWindows Phone 7の世界に溶け込むアプリを作るShin Ise
 

Plus de Shin Ise (20)

Cross platform development with Xamarin 2.0 + MvvmCross
Cross platform development with Xamarin 2.0 + MvvmCrossCross platform development with Xamarin 2.0 + MvvmCross
Cross platform development with Xamarin 2.0 + MvvmCross
 
いまどきのiOSプログラミング with Xcode5
いまどきのiOSプログラミング with Xcode5いまどきのiOSプログラミング with Xcode5
いまどきのiOSプログラミング with Xcode5
 
すまべんLite@関西#4
すまべんLite@関西#4すまべんLite@関西#4
すまべんLite@関西#4
 
すまべんLite@関西#3
すまべんLite@関西#3すまべんLite@関西#3
すまべんLite@関西#3
 
すまべんLite@関西#2
すまべんLite@関西#2すまべんLite@関西#2
すまべんLite@関西#2
 
すごいHaskell読書会#10
すごいHaskell読書会#10すごいHaskell読書会#10
すごいHaskell読書会#10
 
音声APIを使ってみる
音声APIを使ってみる音声APIを使ってみる
音声APIを使ってみる
 
すまべんLite@関西#1
すまべんLite@関西#1すまべんLite@関西#1
すまべんLite@関西#1
 
Xamarin2.0であそぼう
Xamarin2.0であそぼうXamarin2.0であそぼう
Xamarin2.0であそぼう
 
CoreBluetoothでつくるBluetooth Low Energyデバイス
CoreBluetoothでつくるBluetooth Low EnergyデバイスCoreBluetoothでつくるBluetooth Low Energyデバイス
CoreBluetoothでつくるBluetooth Low Energyデバイス
 
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」
 
GridViewのつかいかた
GridViewのつかいかたGridViewのつかいかた
GridViewのつかいかた
 
iOSのVoiceOver対応開発 Rev2
iOSのVoiceOver対応開発 Rev2iOSのVoiceOver対応開発 Rev2
iOSのVoiceOver対応開発 Rev2
 
MediaLibrary で あそぼう
MediaLibrary で あそぼうMediaLibrary で あそぼう
MediaLibrary で あそぼう
 
実践 Reactive Extensions
実践 Reactive Extensions実践 Reactive Extensions
実践 Reactive Extensions
 
本当は怖いSilverlight for Windows Phone Toolkit
本当は怖いSilverlight for Windows Phone Toolkit本当は怖いSilverlight for Windows Phone Toolkit
本当は怖いSilverlight for Windows Phone Toolkit
 
Macで使うWindows Phone 7
Macで使うWindows Phone 7Macで使うWindows Phone 7
Macで使うWindows Phone 7
 
iOSのVoiceOver対応開発
iOSのVoiceOver対応開発iOSのVoiceOver対応開発
iOSのVoiceOver対応開発
 
Galaxy tab で持ち歩くモバイルサーバー
Galaxy tab で持ち歩くモバイルサーバーGalaxy tab で持ち歩くモバイルサーバー
Galaxy tab で持ち歩くモバイルサーバー
 
ハブインテグレーションでWindows Phone 7の世界に溶け込むアプリを作る
ハブインテグレーションでWindows Phone 7の世界に溶け込むアプリを作るハブインテグレーションでWindows Phone 7の世界に溶け込むアプリを作る
ハブインテグレーションでWindows Phone 7の世界に溶け込むアプリを作る
 

Dernier

UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 

Dernier (20)

UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 

Socketプログラム Silverlight for Windows Phoneへの移植のポイント

  • 1. Socket Siverlight for Windows Phone Silverlight in⼤大 #19 (Microsoft MVP for Windows Phone)
  • 2. ⾃自⼰己 •  •  –  iPhone / Android –  Windows Phone –  •  EbIRC (WM5/6) •  ZEROProxy (WM5/6) •  Giraffe (WM5/6) •  SongTweeter (WP7)
  • 3. •  ⽤用 ⽤用 •  ⻄西 ⽉月 •  ⼟土 ⼤大 ⼤大 –  –  – 
  • 4. •  Windows Phone “Mango” Socket •  Windows Mobile 6.x .NET Compact Framework –  ⾮非 •  ⽻羽⽬目 •  Socket
  • 5. •  .NET Fx Silverlight Socket •  –  –  • 
  • 6. .NET Fx Silverlight Socket •  .NET Fx Silverlight for Windows Phone System.Net.Socket •  •  Silverlight Socket –  NetworkStream •  StreamReader •  ⼿手 –  SslStream SSL ( )
  • 7. .NET Framework Socket public IAsyncResult BeginReceive(byte[ ] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode, AsyncCallback callback, object state) Begin- / End- IAsyncResult
  • 8. Silverlight for WP Socket public bool ReceiveAsync(SocketAsyncEventArgs e) ( ) 2 EventArgs ⾮非 ⾮非 ⼊入 true
  • 9. •  –  Socket •  •  •  ⼊入 –  .NET Framework ⾚赤
  • 10. •  .NET Framework m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); m_connectAsync = m_socket.BeginConnect(remoteEndPoint, new AsyncCallback(OnConnected), m_socket); protected void OnConnected(IAsyncResult ar) { try { // // ( EndConnect SocketException ) Socket socket = (Socket)ar.AsyncState; socket.EndConnect(ar); IAsyncResult
  • 11. •  Silverlight for Windows Phone SocketAsyncEventArgs eargs = new SocketAsyncEventArgs(); eargs.RemoteEndPoint = remoteEndPoint; eargs.Completed += new EventHandler<SocketAsyncEventArgs>(ConnectCompleted); m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); EventArgs if (!m_socket.ConnectAsync(eargs)) { // ConnectCompleted(m_socket, eargs); } ⾃自
  • 12. •  .NET Framework m_stream = new NetworkStream(socket); m_reader = new StreamReader(m_stream, this.Encoding); while (true) { string line =m_reader.ReadLine(); -- -- } NetworkStream StreamReader 1 ⾏行行
  • 13. •  Silverlight for Windows Phone m_receiveBuffer = new byte[2048]; SocketAsyncEventArgs e = new SocketAsyncEventArgs(); e.SetBuffer(m_receiveBuffer, 0, m_receiveBuffer.Length); e.Completed += new EventHandler<SocketAsyncEventArgs>(ReceiveCompleted); m_socket.ReceiveAsync(e); ⾃自
  • 14. •  Silverlight for Windows Phone void ReceiveCompleted(object sender, SocketAsyncEventArgs e) { if (e.SocketError == SocketError.Success) { if (e.BytesTransferred > 0) { ⾃自 // snip ⾃自 } if (!m_sendLoopStop) Receive(); ⾃自 BeginReceive } else { ProcessSocketError(e.SocketError); } }
  • 15. •  .NET Compact Framework •  –  –  ⽕火 •  –  •  DnsEndPoint –  –  (Control.Invoke/ Dispatcher.Invoke)
  • 17. •  Socket –  Background Agent ⾏行行 •  Socket ⽤用 –  IRC •  IRC •  IRC Toast •  iOS4 Long-time Task ⾔言 •  UX –  ⾃自 –  ⼀一 (pirc )