SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
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            )

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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の世界に溶け込むアプリを作る
 

Kürzlich hochgeladen

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Kürzlich hochgeladen (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

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 )