SlideShare a Scribd company logo
1 of 60
Download to read offline
Comunicandonuestras appscon el mundo exterior 
Roberto Luis Bisbé 
rlbisbe.net 
@rlbisbe
@rlbisbe 
•Ingeniero en Informática @ UAM 
•Desarrollador @ frontiers 
•WP, W8 & Android dev 
•rlbisbe.net
Corría el año2006…
Corría el año2006…
Penetrómetro
Penetrómetro
.NET Compact 
Framework 
.NET 
Framework 
USB 
RemoteAPI
Comunicarnuestras appscon el mundo exterior
Imagen: https://flic.kr/p/aKN6u6 
Examinandola superficie
RaspberryPI 
•ARM 
•Linux 
•USB 
•Ethernet 
•Sensores
RaspberryPI 
•ARM 
•Linux 
•USB 
•Ethernet 
•Sensores
API REST!
Web Sockets
! Web Socket 
•SignalR 
•.NET 
•socket.io 
•node.js 
•Python 
•faye 
•ruby
Qué es WebSocket 
•Bidireccional 
•HTTP 
•Soporte nativo en 8.x
Servidor 
varserver = http.createServer(app) 
server.listen(1430) 
varwss= new WebSocketServer({ server: server }); 
wss.on("connection", function(ws) { 
ws.on("message", function(data) { 
ws.send("response"); 
}) 
ws.on("close", function() { 
//Closed 
}) 
}
Servidor 
varserver = http.createServer(app) 
server.listen(1430) 
varwss= new WebSocketServer({ server: server }); 
wss.on("connection", function(ws) { 
ws.on("message", function(data) { 
ws.send("response"); 
}) 
ws.on("close", function() { 
//Closed 
}) 
}
Servidor 
varserver = http.createServer(app) 
server.listen(1430) 
varwss= new WebSocketServer({ server: server }); 
wss.on("connection", function(ws) { 
ws.on("message", function(data) { 
ws.send("response"); 
}) 
ws.on("close", function() { 
//Closed 
}) 
}
Cliente -Conexión 
varwebSocket= new MessageWebSocket(); 
webSocket.Control.MessageType= SocketMessageType.Utf8; 
webSocket.MessageReceived+= ProcessMessageReceived; 
webSocket.Closed+= Closed; 
awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
Cliente -Conexión 
ver webSocket= new MessageWebSocket(); 
webSocket.Control.MessageType= SocketMessageType.Utf8; 
webSocket.MessageReceived+= ProcessMessageReceived; 
webSocket.Closed+= Closed; 
awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
Cliente -Conexión 
ver webSocket= new MessageWebSocket(); 
webSocket.Control.MessageType= SocketMessageType.Utf8; 
webSocket.MessageReceived+= ProcessMessageReceived; 
webSocket.Closed+= Closed; 
awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
Cliente -Conexión 
ver webSocket= new MessageWebSocket(); 
webSocket.Control.MessageType= SocketMessageType.Utf8; 
webSocket.MessageReceived+= ProcessMessageReceived; 
webSocket.Closed+= Closed; 
awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
Cliente -Envío y recepción 
var_messageWriter= new DataWriter(webSocket.OutputStream); 
_messageWriter.WriteString(message); 
await_messageWriter.StoreAsync(); 
varstream = new 
StreamReader(args.GetDataStream().AsStreamForRead()); 
stringmessage= stream.ReadToEnd();
Cliente -Envío y recepción 
var_messageWriter= new DataWriter(webSocket.OutputStream); 
_messageWriter.WriteString(message); 
await_messageWriter.StoreAsync(); 
varstream = new 
StreamReader(args.GetDataStream().AsStreamForRead()); 
stringmessage= stream.ReadToEnd();
Ejemplo completo 
DEMO 
C# 
Node JS 
WebSocket
WebSocket 
•Bidireccional 
•HTTP 
•Soporte nativo en 8.x
Bajando de nivel 
Imagen: https://flic.kr/p/aKN6u6
StreamSockets 
•Flujo de datos sobre TCP 
•Texto, imágenes, audio, vídeo… 
•Permisos
Servidor -Conexión 
varlistenSocket= new StreamSocketListener(); 
listenSocket.ConnectionReceived+= ConnectionReceived; 
awaitlistenSocket.BindServiceNameAsync("5000");
Servidor -Recepción 
DataReaderreader= new DataReader(connectionSocket.InputStream); 
uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); 
if(sizeFieldCount!= sizeof(long)) return; 
uintresultLength= (uint)reader.ReadInt32(); 
uintactualResultLength= awaitreader.LoadAsync(resultLength); 
if(resultLength!= actualResultLength) return; 
varbyteResult= new byte[resultLength]; 
reader.ReadBytes(byteResult);
Servidor -Recepción 
DataReaderreader= new DataReader(connectionSocket.InputStream); 
uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); 
if(sizeFieldCount!= sizeof(long)) return; 
uintresultLength= (uint)reader.ReadInt32(); 
uintactualResultLength= awaitreader.LoadAsync(resultLength); 
if(resultLength!= actualResultLength) return; 
varbyteResult= new byte[resultLength]; 
reader.ReadBytes(byteResult);
Servidor -Recepción 
uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); 
if(sizeFieldCount!= sizeof(long)) return; 
uintresultLength= (uint)reader.ReadInt32(); 
uintactualResultLength= awaitreader.LoadAsync(resultLength); 
if(resultLength!= actualResultLength) return; 
varbyteResult= new byte[resultLength]; 
reader.ReadBytes(byteResult);
Cliente -Conexión 
varconnectionSocket= new StreamSocket(); 
varserverHost= new HostName(server); 
awaitconnectionSocket.ConnectAsync(serverHost, port);
Cliente -Envío 
varwriter= new DataWriter(connectionSocket.OutputStream); 
writer.WriteInt32(bytes.Length); 
writer.WriteBytes(bytes); 
awaitwriter.StoreAsync(); 
writer.DetachStream();
Cliente -Envío 
varwriter= new DataWriter(connectionSocket.OutputStream); 
writer.WriteInt32(bytes.Length); 
writer.WriteBytes(bytes); 
awaitwriter.StoreAsync(); 
writer.DetachStream();
Cliente -Envío 
varwriter= new DataWriter(connectionSocket.OutputStream); 
writer.WriteInt32(bytes.Length); 
writer.WriteBytes(bytes); 
awaitwriter.StoreAsync(); 
writer.DetachStream();
Ejemplo completo 
DEMO 
WinRTC# 
WinRTC# 
Socket
StreamSockets 
•Flujo de datos sobre TCP 
•Texto, imágenes, audio, vídeo… 
•Requiere permisos
En las profundidades 
Imagen: https://flic.kr/p/48XdaQ
PebbleSmartwatch 
•iOS & Android 
•APIs 
•SDK 
•Bluetooth!
Las cosas no siempre salen como esperamos 
Imagen: https://flic.kr/p/8bDAS1
Volvamos a la RaspberryPI 
•ARM 
•Linux 
•USB 
•Ethernet 
•Sensores
Volvamos a la RaspberryPI 
•ARM 
•Linux 
•USB 
•Ethernet 
•Sensores
Volvamos a la RaspberryPI 
•ARM 
•Linux 
•USB + Bluetooth 
•Ethernet 
•Sensores
Bluetooth IS EVIL 
•P2P 
•Alcance 
•Consumo 
•Servicios 
•Ancho de banda 
•Pairing, Búsqueda, Conexión
Servidor 
server_sock=BluetoothSocket( RFCOMM ) 
server_sock.bind(("",22)) 
server_sock.listen(22) 
client_sock, client_info= server_sock.accept() 
whileTrue: 
data = client_sock.recv(1024) 
client_sock.close() 
server_sock.close()
Servidor 
server_sock=BluetoothSocket( RFCOMM ) 
server_sock.bind(("",22)) 
server_sock.listen(22) 
client_sock, client_info= server_sock.accept() 
whileTrue: 
data = client_sock.recv(1024) 
client_sock.close() 
server_sock.close()
Servidor 
server_sock=BluetoothSocket( RFCOMM ) 
server_sock.bind(("",22)) 
server_sock.listen(22) 
client_sock, client_info= server_sock.accept() 
whileTrue: 
data = client_sock.recv(1024) 
client_sock.close() 
server_sock.close()
Cliente -Búsqueda 
chatServiceInfoCollection= 
awaitDeviceInformation.FindAllAsync( 
RfcommDeviceService.GetDeviceSelector( 
RfcommServiceId.SerialPort));
Cliente –Conexión 
varchatServiceInfo= chatServiceInfoCollection[0]; 
varservice= 
awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); 
awaitchatSocket.ConnectAsync( 
service.ConnectionHostName, 
service.ConnectionServiceName); 
varchatWriter= new DataWriter(chatSocket.OutputStream); 
varchatReader= new DataReader(chatSocket.InputStream);
Cliente –Conexión 
varchatServiceInfo= chatServiceInfoCollection[0]; 
varservice= 
awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); 
awaitchatSocket.ConnectAsync( 
service.ConnectionHostName, 
service.ConnectionServiceName); 
varchatWriter= new DataWriter(chatSocket.OutputStream); 
varchatReader= new DataReader(chatSocket.InputStream);
Cliente –Conexión 
varchatServiceInfo= chatServiceInfoCollection[0]; 
varservice= 
awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); 
awaitchatSocket.ConnectAsync( 
service.ConnectionHostName, 
service.ConnectionServiceName); 
varchatWriter= new DataWriter(chatSocket.OutputStream); 
varchatReader= new DataReader(chatSocket.InputStream);
Cliente –Envío y recepción 
chatWriter.WriteString("open"); 
awaitchatWriter.StoreAsync(); 
byte[] buffer = new byte[10]; 
awaitchatSocket.InputStream.ReadAsync( 
buffer.AsBuffer(), 10, 
InputStreamOptions.Partial); 
stringresult= System.Text.Encoding.UTF8.GetString(buffer, 0, 10);
Cliente –Envío y recepción 
chatWriter.WriteString("open"); 
awaitchatWriter.StoreAsync(); 
byte[] buffer = new byte[10]; 
awaitchatSocket.InputStream.ReadAsync( 
buffer.AsBuffer(), 10, 
InputStreamOptions.Partial); 
stringresult= System.Text.Encoding.UTF8.GetString(buffer, 0, 10);
Ejemplo completo 
DEMO 
C# 
Python 
Bluetooth Serial Port
Bluetooth IS STILL EVIL 
•P2P 
•Alcance 
•Consumo 
•Servicios 
•Ancho de banda 
•Pairing, Búsqueda, Conexión
Podemos comunicarnuestras apps con el mundo exterior
WebSockets, sockets, bluetooth, GPS, infrarrojos, sonido, NFC, sensores
Preguntas? Hay regalitos…
Gracias! Enlaces, código y slidesen rlbisbe.net 
roberto.luis@rlbisbe.net 
@rlbisbe

More Related Content

What's hot

Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of dockerPHP Indonesia
 
WebAssembly WASM Introduction Presentation
WebAssembly WASM Introduction PresentationWebAssembly WASM Introduction Presentation
WebAssembly WASM Introduction PresentationBrad Beiermann
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance OptimizationChen-Tien Tsai
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactChen-Tien Tsai
 
Javascript Myths and its Evolution
Javascript Myths and its  EvolutionJavascript Myths and its  Evolution
Javascript Myths and its EvolutionDeepu S Nath
 
JS digest, March 2017
JS digest, March 2017JS digest, March 2017
JS digest, March 2017ElifTech
 
Open Source Flash 2010
Open Source Flash 2010Open Source Flash 2010
Open Source Flash 2010Gaurav Saxena
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the WebCodeValue
 
Managing Node.js Instances with Oracle APEX
Managing Node.js Instances with Oracle APEXManaging Node.js Instances with Oracle APEX
Managing Node.js Instances with Oracle APEXKai Donato
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami SayarFITC
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.jsKasey McCurdy
 
JS digest. May 2017
JS digest. May 2017JS digest. May 2017
JS digest. May 2017ElifTech
 
GeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime WebGeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime WebBhagaban Behera
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJSJITENDRA KUMAR PATEL
 
MEAN Stack
MEAN StackMEAN Stack
MEAN StackDotitude
 

What's hot (20)

Afrimadoni the power of docker
Afrimadoni   the power of dockerAfrimadoni   the power of docker
Afrimadoni the power of docker
 
Build App with Nodejs - YWC Workshop
Build App with Nodejs - YWC WorkshopBuild App with Nodejs - YWC Workshop
Build App with Nodejs - YWC Workshop
 
WebAssembly WASM Introduction Presentation
WebAssembly WASM Introduction PresentationWebAssembly WASM Introduction Presentation
WebAssembly WASM Introduction Presentation
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
 
Javascript Myths and its Evolution
Javascript Myths and its  EvolutionJavascript Myths and its  Evolution
Javascript Myths and its Evolution
 
Evolution of java script libraries
Evolution of java script librariesEvolution of java script libraries
Evolution of java script libraries
 
JS digest, March 2017
JS digest, March 2017JS digest, March 2017
JS digest, March 2017
 
Open Source Flash 2010
Open Source Flash 2010Open Source Flash 2010
Open Source Flash 2010
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the Web
 
Managing Node.js Instances with Oracle APEX
Managing Node.js Instances with Oracle APEXManaging Node.js Instances with Oracle APEX
Managing Node.js Instances with Oracle APEX
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami Sayar
 
Node.js for beginner
Node.js for beginnerNode.js for beginner
Node.js for beginner
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
JS digest. May 2017
JS digest. May 2017JS digest. May 2017
JS digest. May 2017
 
GeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime WebGeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime Web
 
Tech talk: PHP
Tech talk: PHPTech talk: PHP
Tech talk: PHP
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
CloudFoundry@home
CloudFoundry@homeCloudFoundry@home
CloudFoundry@home
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
 

Viewers also liked

Windows 8 Universidad de Valencia
Windows 8 Universidad de ValenciaWindows 8 Universidad de Valencia
Windows 8 Universidad de ValenciaRoberto Luis Bisbé
 
Lecciones aprendidas creando una red social
Lecciones aprendidas creando una red socialLecciones aprendidas creando una red social
Lecciones aprendidas creando una red socialRoberto Luis Bisbé
 
Tres tecnologías Microsoft que no se dan en la carrera
Tres tecnologías Microsoft que no se dan en la carreraTres tecnologías Microsoft que no se dan en la carrera
Tres tecnologías Microsoft que no se dan en la carreraRoberto Luis Bisbé
 
Creando aplicaciones móviles con Windows 8 y Windows Phone 8
Creando aplicaciones móviles con Windows 8 y Windows Phone 8Creando aplicaciones móviles con Windows 8 y Windows Phone 8
Creando aplicaciones móviles con Windows 8 y Windows Phone 8Roberto Luis Bisbé
 
Windows 8 y Metro para desarrolladores .NET
Windows 8 y Metro para desarrolladores .NETWindows 8 y Metro para desarrolladores .NET
Windows 8 y Metro para desarrolladores .NETRoberto Luis Bisbé
 
Una visión multiplataforma con aspnet v next
Una visión multiplataforma con aspnet v nextUna visión multiplataforma con aspnet v next
Una visión multiplataforma con aspnet v nextEduard Tomàs
 
De escritorio a Javascript, nuestra experiencia desde las trincheras
De escritorio a Javascript, nuestra experiencia desde las trincherasDe escritorio a Javascript, nuestra experiencia desde las trincheras
De escritorio a Javascript, nuestra experiencia desde las trincherasRoberto Luis Bisbé
 
Javascript vuela en primera clase con Firefox OS
Javascript vuela en primera clase con Firefox OSJavascript vuela en primera clase con Firefox OS
Javascript vuela en primera clase con Firefox OSRoberto Luis Bisbé
 
DotNetSpain2015: Extendiendo Visual Studio Online a través de su API
DotNetSpain2015: Extendiendo Visual Studio Online a través de su APIDotNetSpain2015: Extendiendo Visual Studio Online a través de su API
DotNetSpain2015: Extendiendo Visual Studio Online a través de su APIRoberto Luis Bisbé
 

Viewers also liked (13)

Windows 8 Universidad de Valencia
Windows 8 Universidad de ValenciaWindows 8 Universidad de Valencia
Windows 8 Universidad de Valencia
 
Lecciones aprendidas creando una red social
Lecciones aprendidas creando una red socialLecciones aprendidas creando una red social
Lecciones aprendidas creando una red social
 
Tres tecnologías Microsoft que no se dan en la carrera
Tres tecnologías Microsoft que no se dan en la carreraTres tecnologías Microsoft que no se dan en la carrera
Tres tecnologías Microsoft que no se dan en la carrera
 
Creando aplicaciones móviles con Windows 8 y Windows Phone 8
Creando aplicaciones móviles con Windows 8 y Windows Phone 8Creando aplicaciones móviles con Windows 8 y Windows Phone 8
Creando aplicaciones móviles con Windows 8 y Windows Phone 8
 
Windows 8 y Metro para desarrolladores .NET
Windows 8 y Metro para desarrolladores .NETWindows 8 y Metro para desarrolladores .NET
Windows 8 y Metro para desarrolladores .NET
 
Windows phonesessions
Windows phonesessionsWindows phonesessions
Windows phonesessions
 
Una visión multiplataforma con aspnet v next
Una visión multiplataforma con aspnet v nextUna visión multiplataforma con aspnet v next
Una visión multiplataforma con aspnet v next
 
De escritorio a Javascript, nuestra experiencia desde las trincheras
De escritorio a Javascript, nuestra experiencia desde las trincherasDe escritorio a Javascript, nuestra experiencia desde las trincheras
De escritorio a Javascript, nuestra experiencia desde las trincheras
 
Javascript vuela en primera clase con Firefox OS
Javascript vuela en primera clase con Firefox OSJavascript vuela en primera clase con Firefox OS
Javascript vuela en primera clase con Firefox OS
 
DotNetSpain2015: Extendiendo Visual Studio Online a través de su API
DotNetSpain2015: Extendiendo Visual Studio Online a través de su APIDotNetSpain2015: Extendiendo Visual Studio Online a través de su API
DotNetSpain2015: Extendiendo Visual Studio Online a través de su API
 
Desarrollo Full Stack UAM.net
Desarrollo Full Stack UAM.netDesarrollo Full Stack UAM.net
Desarrollo Full Stack UAM.net
 
APIs REST
APIs RESTAPIs REST
APIs REST
 
Los lenguajes de la web
Los lenguajes de la webLos lenguajes de la web
Los lenguajes de la web
 

Similar to Comunicando nuestras apps con el mundo exterior

StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop OverviewShubhra Kar
 
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...Alexandre Brandão Lustosa
 
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummitMatrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummitAlan Quayle
 
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
 
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015SenZations Summer School
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationStuart (Pid) Williams
 
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & ImplementationWebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & ImplementationAmir Zmora
 
MUM Middle East 2016 - System Integration Analyst
MUM Middle East 2016 - System Integration AnalystMUM Middle East 2016 - System Integration Analyst
MUM Middle East 2016 - System Integration AnalystFajar Nugroho
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1Mohammad Qureshi
 
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...mfrancis
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Adam Dunkels
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSocketsGonzalo Ayuso
 
Jugando con websockets en nodeJS
Jugando con websockets en nodeJSJugando con websockets en nodeJS
Jugando con websockets en nodeJSIsrael Gutiérrez
 
Vert.X and MSA - DevOps
Vert.X and MSA - DevOpsVert.X and MSA - DevOps
Vert.X and MSA - DevOpsYongHyuk Lee
 

Similar to Comunicando nuestras apps con el mundo exterior (20)

signalr
signalrsignalr
signalr
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
 
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummitMatrix.org decentralised communication, Matthew Hodgson, TADSummit
Matrix.org decentralised communication, Matthew Hodgson, TADSummit
 
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
 
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
WebSocket
WebSocketWebSocket
WebSocket
 
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & ImplementationWebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
 
Real time web apps
Real time web appsReal time web apps
Real time web apps
 
MUM Middle East 2016 - System Integration Analyst
MUM Middle East 2016 - System Integration AnalystMUM Middle East 2016 - System Integration Analyst
MUM Middle East 2016 - System Integration Analyst
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
 
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
Apache Directory and the OSGi Service Platform - Enrique Rodriguez, PMC Membe...
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 
Jugando con websockets en nodeJS
Jugando con websockets en nodeJSJugando con websockets en nodeJS
Jugando con websockets en nodeJS
 
111214 node conf
111214 node conf111214 node conf
111214 node conf
 
Apache Libcloud
Apache LibcloudApache Libcloud
Apache Libcloud
 
Vert.X and MSA - DevOps
Vert.X and MSA - DevOpsVert.X and MSA - DevOps
Vert.X and MSA - DevOps
 

More from Roberto Luis Bisbé

More from Roberto Luis Bisbé (8)

Scala desde c# y JavaScript
Scala desde c# y JavaScriptScala desde c# y JavaScript
Scala desde c# y JavaScript
 
Desarrollo de aplicaciones para Windows 8 y Windows Phone
Desarrollo de aplicaciones para Windows 8 y Windows PhoneDesarrollo de aplicaciones para Windows 8 y Windows Phone
Desarrollo de aplicaciones para Windows 8 y Windows Phone
 
Desarrollo Metro con Windows 8 UPM
Desarrollo Metro con Windows 8 UPMDesarrollo Metro con Windows 8 UPM
Desarrollo Metro con Windows 8 UPM
 
Aplicaciones Metro para Windows 8
Aplicaciones Metro para Windows 8Aplicaciones Metro para Windows 8
Aplicaciones Metro para Windows 8
 
Hardcore PHP
Hardcore PHPHardcore PHP
Hardcore PHP
 
El patrón MVC
El patrón MVCEl patrón MVC
El patrón MVC
 
Social Media
Social MediaSocial Media
Social Media
 
Fundamentos de sitios web accesibles
Fundamentos de sitios web accesiblesFundamentos de sitios web accesibles
Fundamentos de sitios web accesibles
 

Recently uploaded

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 

Recently uploaded (20)

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 

Comunicando nuestras apps con el mundo exterior

  • 1. Comunicandonuestras appscon el mundo exterior Roberto Luis Bisbé rlbisbe.net @rlbisbe
  • 2. @rlbisbe •Ingeniero en Informática @ UAM •Desarrollador @ frontiers •WP, W8 & Android dev •rlbisbe.net
  • 7. .NET Compact Framework .NET Framework USB RemoteAPI
  • 10. RaspberryPI •ARM •Linux •USB •Ethernet •Sensores
  • 11. RaspberryPI •ARM •Linux •USB •Ethernet •Sensores
  • 14. ! Web Socket •SignalR •.NET •socket.io •node.js •Python •faye •ruby
  • 15. Qué es WebSocket •Bidireccional •HTTP •Soporte nativo en 8.x
  • 16. Servidor varserver = http.createServer(app) server.listen(1430) varwss= new WebSocketServer({ server: server }); wss.on("connection", function(ws) { ws.on("message", function(data) { ws.send("response"); }) ws.on("close", function() { //Closed }) }
  • 17. Servidor varserver = http.createServer(app) server.listen(1430) varwss= new WebSocketServer({ server: server }); wss.on("connection", function(ws) { ws.on("message", function(data) { ws.send("response"); }) ws.on("close", function() { //Closed }) }
  • 18. Servidor varserver = http.createServer(app) server.listen(1430) varwss= new WebSocketServer({ server: server }); wss.on("connection", function(ws) { ws.on("message", function(data) { ws.send("response"); }) ws.on("close", function() { //Closed }) }
  • 19. Cliente -Conexión varwebSocket= new MessageWebSocket(); webSocket.Control.MessageType= SocketMessageType.Utf8; webSocket.MessageReceived+= ProcessMessageReceived; webSocket.Closed+= Closed; awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
  • 20. Cliente -Conexión ver webSocket= new MessageWebSocket(); webSocket.Control.MessageType= SocketMessageType.Utf8; webSocket.MessageReceived+= ProcessMessageReceived; webSocket.Closed+= Closed; awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
  • 21. Cliente -Conexión ver webSocket= new MessageWebSocket(); webSocket.Control.MessageType= SocketMessageType.Utf8; webSocket.MessageReceived+= ProcessMessageReceived; webSocket.Closed+= Closed; awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
  • 22. Cliente -Conexión ver webSocket= new MessageWebSocket(); webSocket.Control.MessageType= SocketMessageType.Utf8; webSocket.MessageReceived+= ProcessMessageReceived; webSocket.Closed+= Closed; awaitwebSocket.ConnectAsync(new Uri("ws://IP:9999"));
  • 23. Cliente -Envío y recepción var_messageWriter= new DataWriter(webSocket.OutputStream); _messageWriter.WriteString(message); await_messageWriter.StoreAsync(); varstream = new StreamReader(args.GetDataStream().AsStreamForRead()); stringmessage= stream.ReadToEnd();
  • 24. Cliente -Envío y recepción var_messageWriter= new DataWriter(webSocket.OutputStream); _messageWriter.WriteString(message); await_messageWriter.StoreAsync(); varstream = new StreamReader(args.GetDataStream().AsStreamForRead()); stringmessage= stream.ReadToEnd();
  • 25. Ejemplo completo DEMO C# Node JS WebSocket
  • 26. WebSocket •Bidireccional •HTTP •Soporte nativo en 8.x
  • 27. Bajando de nivel Imagen: https://flic.kr/p/aKN6u6
  • 28. StreamSockets •Flujo de datos sobre TCP •Texto, imágenes, audio, vídeo… •Permisos
  • 29. Servidor -Conexión varlistenSocket= new StreamSocketListener(); listenSocket.ConnectionReceived+= ConnectionReceived; awaitlistenSocket.BindServiceNameAsync("5000");
  • 30. Servidor -Recepción DataReaderreader= new DataReader(connectionSocket.InputStream); uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); if(sizeFieldCount!= sizeof(long)) return; uintresultLength= (uint)reader.ReadInt32(); uintactualResultLength= awaitreader.LoadAsync(resultLength); if(resultLength!= actualResultLength) return; varbyteResult= new byte[resultLength]; reader.ReadBytes(byteResult);
  • 31. Servidor -Recepción DataReaderreader= new DataReader(connectionSocket.InputStream); uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); if(sizeFieldCount!= sizeof(long)) return; uintresultLength= (uint)reader.ReadInt32(); uintactualResultLength= awaitreader.LoadAsync(resultLength); if(resultLength!= actualResultLength) return; varbyteResult= new byte[resultLength]; reader.ReadBytes(byteResult);
  • 32. Servidor -Recepción uintsizeFieldCount= awaitreader.LoadAsync(sizeof(long)); if(sizeFieldCount!= sizeof(long)) return; uintresultLength= (uint)reader.ReadInt32(); uintactualResultLength= awaitreader.LoadAsync(resultLength); if(resultLength!= actualResultLength) return; varbyteResult= new byte[resultLength]; reader.ReadBytes(byteResult);
  • 33. Cliente -Conexión varconnectionSocket= new StreamSocket(); varserverHost= new HostName(server); awaitconnectionSocket.ConnectAsync(serverHost, port);
  • 34. Cliente -Envío varwriter= new DataWriter(connectionSocket.OutputStream); writer.WriteInt32(bytes.Length); writer.WriteBytes(bytes); awaitwriter.StoreAsync(); writer.DetachStream();
  • 35. Cliente -Envío varwriter= new DataWriter(connectionSocket.OutputStream); writer.WriteInt32(bytes.Length); writer.WriteBytes(bytes); awaitwriter.StoreAsync(); writer.DetachStream();
  • 36. Cliente -Envío varwriter= new DataWriter(connectionSocket.OutputStream); writer.WriteInt32(bytes.Length); writer.WriteBytes(bytes); awaitwriter.StoreAsync(); writer.DetachStream();
  • 37. Ejemplo completo DEMO WinRTC# WinRTC# Socket
  • 38. StreamSockets •Flujo de datos sobre TCP •Texto, imágenes, audio, vídeo… •Requiere permisos
  • 39. En las profundidades Imagen: https://flic.kr/p/48XdaQ
  • 40. PebbleSmartwatch •iOS & Android •APIs •SDK •Bluetooth!
  • 41. Las cosas no siempre salen como esperamos Imagen: https://flic.kr/p/8bDAS1
  • 42. Volvamos a la RaspberryPI •ARM •Linux •USB •Ethernet •Sensores
  • 43. Volvamos a la RaspberryPI •ARM •Linux •USB •Ethernet •Sensores
  • 44. Volvamos a la RaspberryPI •ARM •Linux •USB + Bluetooth •Ethernet •Sensores
  • 45. Bluetooth IS EVIL •P2P •Alcance •Consumo •Servicios •Ancho de banda •Pairing, Búsqueda, Conexión
  • 46. Servidor server_sock=BluetoothSocket( RFCOMM ) server_sock.bind(("",22)) server_sock.listen(22) client_sock, client_info= server_sock.accept() whileTrue: data = client_sock.recv(1024) client_sock.close() server_sock.close()
  • 47. Servidor server_sock=BluetoothSocket( RFCOMM ) server_sock.bind(("",22)) server_sock.listen(22) client_sock, client_info= server_sock.accept() whileTrue: data = client_sock.recv(1024) client_sock.close() server_sock.close()
  • 48. Servidor server_sock=BluetoothSocket( RFCOMM ) server_sock.bind(("",22)) server_sock.listen(22) client_sock, client_info= server_sock.accept() whileTrue: data = client_sock.recv(1024) client_sock.close() server_sock.close()
  • 49. Cliente -Búsqueda chatServiceInfoCollection= awaitDeviceInformation.FindAllAsync( RfcommDeviceService.GetDeviceSelector( RfcommServiceId.SerialPort));
  • 50. Cliente –Conexión varchatServiceInfo= chatServiceInfoCollection[0]; varservice= awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); awaitchatSocket.ConnectAsync( service.ConnectionHostName, service.ConnectionServiceName); varchatWriter= new DataWriter(chatSocket.OutputStream); varchatReader= new DataReader(chatSocket.InputStream);
  • 51. Cliente –Conexión varchatServiceInfo= chatServiceInfoCollection[0]; varservice= awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); awaitchatSocket.ConnectAsync( service.ConnectionHostName, service.ConnectionServiceName); varchatWriter= new DataWriter(chatSocket.OutputStream); varchatReader= new DataReader(chatSocket.InputStream);
  • 52. Cliente –Conexión varchatServiceInfo= chatServiceInfoCollection[0]; varservice= awaitRfcommDeviceService.FromIdAsync(chatServiceInfo.Id); awaitchatSocket.ConnectAsync( service.ConnectionHostName, service.ConnectionServiceName); varchatWriter= new DataWriter(chatSocket.OutputStream); varchatReader= new DataReader(chatSocket.InputStream);
  • 53. Cliente –Envío y recepción chatWriter.WriteString("open"); awaitchatWriter.StoreAsync(); byte[] buffer = new byte[10]; awaitchatSocket.InputStream.ReadAsync( buffer.AsBuffer(), 10, InputStreamOptions.Partial); stringresult= System.Text.Encoding.UTF8.GetString(buffer, 0, 10);
  • 54. Cliente –Envío y recepción chatWriter.WriteString("open"); awaitchatWriter.StoreAsync(); byte[] buffer = new byte[10]; awaitchatSocket.InputStream.ReadAsync( buffer.AsBuffer(), 10, InputStreamOptions.Partial); stringresult= System.Text.Encoding.UTF8.GetString(buffer, 0, 10);
  • 55. Ejemplo completo DEMO C# Python Bluetooth Serial Port
  • 56. Bluetooth IS STILL EVIL •P2P •Alcance •Consumo •Servicios •Ancho de banda •Pairing, Búsqueda, Conexión
  • 57. Podemos comunicarnuestras apps con el mundo exterior
  • 58. WebSockets, sockets, bluetooth, GPS, infrarrojos, sonido, NFC, sensores
  • 60. Gracias! Enlaces, código y slidesen rlbisbe.net roberto.luis@rlbisbe.net @rlbisbe