SlideShare a Scribd company logo
Can Android be an HTTP Server?
2018.02.06 Tue.
Tsuyoshi Chujo
@ shibuya.apk # 22
About me
Tsuyoshi Chujo
● Freelance engineer of Web services
○ Android, Web server (Servlet, Django, Ruby on Rails), etc.
● Currently, working as an Android developer in a manufacturer
● Social Accounts
○ Qiita: @chooyan-eng
○ GitHub: @chooyan-eng
○ dev.to: @chooyan
○ Twitter: @chooyan_i18n
● CodeYourRuby the device powered by Android
(but NOT a Smart Phone)
Can Android be an HTTP Server?
Ordinal architecture
Client Server
request
response
Can Android be an HTTP Server?
What I would like to discuss today
Client
Server
request
response
YES! Android CAN be an HTTP Server!
● HTTP is based on TCP
● HTTP is a protocol of “How to Control TCP”
○ See OSI or TCP/IP in detail
● All the OS (as far as I know) can use TCP. It’s the function of OS.
● Android OS also can use TCP
● Thus, Android device can be a HTTP server by extending TCP and
implementing the specification on RFC 7230.
How to implement?
● Use java.net.ServerSocket
○ Basic class to accept requests based on TCP/IP protocol
○ InputStream and OutputStream of this class presents TCP Socket.
○ See my GitHub repository if you are interested in usage.
Flow Image
Client Server
open socket
connect accept
GET / HTTP/1.1CRLFUser-Agent: XXXXCRLFCookie:...
parse and calculate the
end of data.
do something...
Then, send back
response.receive data
and parse
send data
HTTP/1.1 200 OKCRLFContent-Type: text/htmlCRLF...
establish connection
Demo
if app does not work… see below :-(
https://www.youtube.com/watch?v=_hZ_UsFKnIU
Open the URL below with your favorite web browser :-)
http://XXX.XXX.XXX.XXX:20000
https://github.com/chooyan-eng/AndroidHttpServerDemo
When to Use? (in my experience)
● Embedded Android (Android on devices for specific operation)
○ Send data DIRECTLY from PC to Android devices via LAN.
○ Send data with TCP connection. (Not using HTTP, but basic idea is the same as discussion here)
end data
and control the device
response
Thank you!

More Related Content

What's hot

GPU最適化入門
GPU最適化入門GPU最適化入門
GPU最適化入門
Takahiro KOGUCHI
 
一人でもはじめるGitでバージョン管理
一人でもはじめるGitでバージョン管理一人でもはじめるGitでバージョン管理
一人でもはじめるGitでバージョン管理
Takafumi Yoshida
 
Confluence と DITA による Webマニュアル作成フロー
Confluence と DITA によるWebマニュアル作成フローConfluence と DITA によるWebマニュアル作成フロー
Confluence と DITA による Webマニュアル作成フロー
Takashi Yamaguchi
 
Kubernetes 導入から始める DevOps について
Kubernetes 導入から始める DevOps についてKubernetes 導入から始める DevOps について
Kubernetes 導入から始める DevOps について
Shigeru Tatsuta
 
正しいものを正しく作る塾-設計コース
正しいものを正しく作る塾-設計コース正しいものを正しく作る塾-設計コース
正しいものを正しく作る塾-設計コース
増田 亨
 
チケット駆動開発の解説~タスク管理からプロセス改善へ
チケット駆動開発の解説~タスク管理からプロセス改善へチケット駆動開発の解説~タスク管理からプロセス改善へ
チケット駆動開発の解説~タスク管理からプロセス改善へ
akipii Oga
 
はじめる! Redmine (2021年版)
はじめる! Redmine (2021年版) はじめる! Redmine (2021年版)
はじめる! Redmine (2021年版)
Go Maeda
 
未来のプログラミング技術をUnityで -UniRx-
未来のプログラミング技術をUnityで -UniRx-未来のプログラミング技術をUnityで -UniRx-
未来のプログラミング技術をUnityで -UniRx-
torisoup
 
REST API、gRPC、GraphQL 触ってみた【2023年12月開催勉強会資料】
REST API、gRPC、GraphQL 触ってみた【2023年12月開催勉強会資料】REST API、gRPC、GraphQL 触ってみた【2023年12月開催勉強会資料】
REST API、gRPC、GraphQL 触ってみた【2023年12月開催勉強会資料】
洵貴 佐川
 
【Unity道場教育スペシャル】Cinemachineで教えるゲームの3つの大切なこと
【Unity道場教育スペシャル】Cinemachineで教えるゲームの3つの大切なこと【Unity道場教育スペシャル】Cinemachineで教えるゲームの3つの大切なこと
【Unity道場教育スペシャル】Cinemachineで教えるゲームの3つの大切なこと
UnityTechnologiesJapan002
 
プロのためのNode-RED再入門
プロのためのNode-RED再入門プロのためのNode-RED再入門
プロのためのNode-RED再入門
Makoto SAKAI
 
UniRxでMV(R)Pパターン をやってみた
UniRxでMV(R)PパターンをやってみたUniRxでMV(R)Pパターンをやってみた
UniRxでMV(R)Pパターン をやってみた
torisoup
 
Node-RED導入時の効果的な開発を考える
Node-RED導入時の効果的な開発を考えるNode-RED導入時の効果的な開発を考える
Node-RED導入時の効果的な開発を考える
Makoto SAKAI
 
複数サービスを使う業務の自動化にはRPA×Node-RED構成がおすすめ/Node-RED Desktop紹介
複数サービスを使う業務の自動化にはRPA×Node-RED構成がおすすめ/Node-RED Desktop紹介複数サービスを使う業務の自動化にはRPA×Node-RED構成がおすすめ/Node-RED Desktop紹介
複数サービスを使う業務の自動化にはRPA×Node-RED構成がおすすめ/Node-RED Desktop紹介
Kazuki Saito
 
UnityでUI開発を高速化した件
UnityでUI開発を高速化した件UnityでUI開発を高速化した件
UnityでUI開発を高速化した件
Grenge, Inc.
 
Unity PackageManagerを使う話。
Unity PackageManagerを使う話。Unity PackageManagerを使う話。
Unity PackageManagerを使う話。
TakayoshiOgawa
 
UE4のレイトレで出来ること/出来ないこと
UE4のレイトレで出来ること/出来ないことUE4のレイトレで出来ること/出来ないこと
UE4のレイトレで出来ること/出来ないこと
Satoshi Kodaira
 
ROS2のリアルタイム化に挑む WG初参加
ROS2のリアルタイム化に挑む WG初参加ROS2のリアルタイム化に挑む WG初参加
ROS2のリアルタイム化に挑む WG初参加
Atsushi Hasegawa
 
20分くらいでわかった気分になれるC++20コルーチン
20分くらいでわかった気分になれるC++20コルーチン20分くらいでわかった気分になれるC++20コルーチン
20分くらいでわかった気分になれるC++20コルーチン
yohhoy
 
Redmineの基本と適用事例
Redmineの基本と適用事例Redmineの基本と適用事例
Redmineの基本と適用事例
Go Maeda
 

What's hot (20)

GPU最適化入門
GPU最適化入門GPU最適化入門
GPU最適化入門
 
一人でもはじめるGitでバージョン管理
一人でもはじめるGitでバージョン管理一人でもはじめるGitでバージョン管理
一人でもはじめるGitでバージョン管理
 
Confluence と DITA による Webマニュアル作成フロー
Confluence と DITA によるWebマニュアル作成フローConfluence と DITA によるWebマニュアル作成フロー
Confluence と DITA による Webマニュアル作成フロー
 
Kubernetes 導入から始める DevOps について
Kubernetes 導入から始める DevOps についてKubernetes 導入から始める DevOps について
Kubernetes 導入から始める DevOps について
 
正しいものを正しく作る塾-設計コース
正しいものを正しく作る塾-設計コース正しいものを正しく作る塾-設計コース
正しいものを正しく作る塾-設計コース
 
チケット駆動開発の解説~タスク管理からプロセス改善へ
チケット駆動開発の解説~タスク管理からプロセス改善へチケット駆動開発の解説~タスク管理からプロセス改善へ
チケット駆動開発の解説~タスク管理からプロセス改善へ
 
はじめる! Redmine (2021年版)
はじめる! Redmine (2021年版) はじめる! Redmine (2021年版)
はじめる! Redmine (2021年版)
 
未来のプログラミング技術をUnityで -UniRx-
未来のプログラミング技術をUnityで -UniRx-未来のプログラミング技術をUnityで -UniRx-
未来のプログラミング技術をUnityで -UniRx-
 
REST API、gRPC、GraphQL 触ってみた【2023年12月開催勉強会資料】
REST API、gRPC、GraphQL 触ってみた【2023年12月開催勉強会資料】REST API、gRPC、GraphQL 触ってみた【2023年12月開催勉強会資料】
REST API、gRPC、GraphQL 触ってみた【2023年12月開催勉強会資料】
 
【Unity道場教育スペシャル】Cinemachineで教えるゲームの3つの大切なこと
【Unity道場教育スペシャル】Cinemachineで教えるゲームの3つの大切なこと【Unity道場教育スペシャル】Cinemachineで教えるゲームの3つの大切なこと
【Unity道場教育スペシャル】Cinemachineで教えるゲームの3つの大切なこと
 
プロのためのNode-RED再入門
プロのためのNode-RED再入門プロのためのNode-RED再入門
プロのためのNode-RED再入門
 
UniRxでMV(R)Pパターン をやってみた
UniRxでMV(R)PパターンをやってみたUniRxでMV(R)Pパターンをやってみた
UniRxでMV(R)Pパターン をやってみた
 
Node-RED導入時の効果的な開発を考える
Node-RED導入時の効果的な開発を考えるNode-RED導入時の効果的な開発を考える
Node-RED導入時の効果的な開発を考える
 
複数サービスを使う業務の自動化にはRPA×Node-RED構成がおすすめ/Node-RED Desktop紹介
複数サービスを使う業務の自動化にはRPA×Node-RED構成がおすすめ/Node-RED Desktop紹介複数サービスを使う業務の自動化にはRPA×Node-RED構成がおすすめ/Node-RED Desktop紹介
複数サービスを使う業務の自動化にはRPA×Node-RED構成がおすすめ/Node-RED Desktop紹介
 
UnityでUI開発を高速化した件
UnityでUI開発を高速化した件UnityでUI開発を高速化した件
UnityでUI開発を高速化した件
 
Unity PackageManagerを使う話。
Unity PackageManagerを使う話。Unity PackageManagerを使う話。
Unity PackageManagerを使う話。
 
UE4のレイトレで出来ること/出来ないこと
UE4のレイトレで出来ること/出来ないことUE4のレイトレで出来ること/出来ないこと
UE4のレイトレで出来ること/出来ないこと
 
ROS2のリアルタイム化に挑む WG初参加
ROS2のリアルタイム化に挑む WG初参加ROS2のリアルタイム化に挑む WG初参加
ROS2のリアルタイム化に挑む WG初参加
 
20分くらいでわかった気分になれるC++20コルーチン
20分くらいでわかった気分になれるC++20コルーチン20分くらいでわかった気分になれるC++20コルーチン
20分くらいでわかった気分になれるC++20コルーチン
 
Redmineの基本と適用事例
Redmineの基本と適用事例Redmineの基本と適用事例
Redmineの基本と適用事例
 

Similar to Can android be an http server

Introducing chrome apps (ogura)
Introducing chrome apps (ogura)Introducing chrome apps (ogura)
Introducing chrome apps (ogura)
Kazuhiro Ogura
 
Android development
Android developmentAndroid development
Android developmentLope Emano
 
Burgas Conf 21.06.2014 - Single page application Angularjs and Nodejs
Burgas Conf 21.06.2014 - Single page application Angularjs and NodejsBurgas Conf 21.06.2014 - Single page application Angularjs and Nodejs
Burgas Conf 21.06.2014 - Single page application Angularjs and Nodejs
Dimitar Danailov
 
Android Study Jam
Android Study Jam Android Study Jam
Android Study Jam
DSCMESCOE
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
Opersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
Opersys inc.
 
Embedded Android Workshop with Oreo
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with Oreo
Opersys inc.
 
You Can Work on the Web Patform! (GOSIM 2023)
You Can Work on the Web Patform! (GOSIM 2023)You Can Work on the Web Patform! (GOSIM 2023)
You Can Work on the Web Patform! (GOSIM 2023)
Igalia
 
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)Hyun-woo Park
 
Journey to become Android Developer - NgodingJeh! @STMIKCIC Cirebon - By: Riz...
Journey to become Android Developer - NgodingJeh! @STMIKCIC Cirebon - By: Riz...Journey to become Android Developer - NgodingJeh! @STMIKCIC Cirebon - By: Riz...
Journey to become Android Developer - NgodingJeh! @STMIKCIC Cirebon - By: Riz...
Rizal Khilman
 
Django on app engine
Django on app engineDjango on app engine
Django on app enginebenpotato
 
Wade.Go Introduction Speech - SFD HCMC 2014
Wade.Go Introduction Speech - SFD HCMC 2014Wade.Go Introduction Speech - SFD HCMC 2014
Wade.Go Introduction Speech - SFD HCMC 2014
Nguyễn Thành Hải
 
Using JavaScript to write Native Mobile Applications
Using JavaScript to write Native Mobile ApplicationsUsing JavaScript to write Native Mobile Applications
Using JavaScript to write Native Mobile Applications
Derek Anderson
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
Opersys inc.
 
Web3_Profile.pdf
Web3_Profile.pdfWeb3_Profile.pdf
Web3_Profile.pdf
Himanshu959762
 
RealDay: Angular.js
RealDay: Angular.jsRealDay: Angular.js
RealDay: Angular.js
Miguel Schmitz Grazziotin
 
SPDY and What to Consider for HTTP/2.0
SPDY and What to Consider for HTTP/2.0SPDY and What to Consider for HTTP/2.0
SPDY and What to Consider for HTTP/2.0
Mike Belshe
 
Introduction of CMS Technology to the People of Tanay, Rizal Philippines
Introduction of CMS Technology to the People of Tanay, Rizal PhilippinesIntroduction of CMS Technology to the People of Tanay, Rizal Philippines
Introduction of CMS Technology to the People of Tanay, Rizal Philippines
Eleison Cruz
 
Android Made Simple
Android Made SimpleAndroid Made Simple
Android Made Simple
Gabriel Dogaru
 

Similar to Can android be an http server (20)

Introducing chrome apps (ogura)
Introducing chrome apps (ogura)Introducing chrome apps (ogura)
Introducing chrome apps (ogura)
 
Android development
Android developmentAndroid development
Android development
 
Burgas Conf 21.06.2014 - Single page application Angularjs and Nodejs
Burgas Conf 21.06.2014 - Single page application Angularjs and NodejsBurgas Conf 21.06.2014 - Single page application Angularjs and Nodejs
Burgas Conf 21.06.2014 - Single page application Angularjs and Nodejs
 
Android Study Jam
Android Study Jam Android Study Jam
Android Study Jam
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Embedded Android Workshop with Oreo
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with Oreo
 
You Can Work on the Web Patform! (GOSIM 2023)
You Can Work on the Web Patform! (GOSIM 2023)You Can Work on the Web Patform! (GOSIM 2023)
You Can Work on the Web Patform! (GOSIM 2023)
 
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
 
Journey to become Android Developer - NgodingJeh! @STMIKCIC Cirebon - By: Riz...
Journey to become Android Developer - NgodingJeh! @STMIKCIC Cirebon - By: Riz...Journey to become Android Developer - NgodingJeh! @STMIKCIC Cirebon - By: Riz...
Journey to become Android Developer - NgodingJeh! @STMIKCIC Cirebon - By: Riz...
 
Django on app engine
Django on app engineDjango on app engine
Django on app engine
 
Wade.Go Introduction Speech - SFD HCMC 2014
Wade.Go Introduction Speech - SFD HCMC 2014Wade.Go Introduction Speech - SFD HCMC 2014
Wade.Go Introduction Speech - SFD HCMC 2014
 
Using JavaScript to write Native Mobile Applications
Using JavaScript to write Native Mobile ApplicationsUsing JavaScript to write Native Mobile Applications
Using JavaScript to write Native Mobile Applications
 
APIs for mobile
APIs for mobileAPIs for mobile
APIs for mobile
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
 
Web3_Profile.pdf
Web3_Profile.pdfWeb3_Profile.pdf
Web3_Profile.pdf
 
RealDay: Angular.js
RealDay: Angular.jsRealDay: Angular.js
RealDay: Angular.js
 
SPDY and What to Consider for HTTP/2.0
SPDY and What to Consider for HTTP/2.0SPDY and What to Consider for HTTP/2.0
SPDY and What to Consider for HTTP/2.0
 
Introduction of CMS Technology to the People of Tanay, Rizal Philippines
Introduction of CMS Technology to the People of Tanay, Rizal PhilippinesIntroduction of CMS Technology to the People of Tanay, Rizal Philippines
Introduction of CMS Technology to the People of Tanay, Rizal Philippines
 
Android Made Simple
Android Made SimpleAndroid Made Simple
Android Made Simple
 

Recently uploaded

Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 

Recently uploaded (20)

Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 

Can android be an http server

  • 1. Can Android be an HTTP Server? 2018.02.06 Tue. Tsuyoshi Chujo @ shibuya.apk # 22
  • 2. About me Tsuyoshi Chujo ● Freelance engineer of Web services ○ Android, Web server (Servlet, Django, Ruby on Rails), etc. ● Currently, working as an Android developer in a manufacturer ● Social Accounts ○ Qiita: @chooyan-eng ○ GitHub: @chooyan-eng ○ dev.to: @chooyan ○ Twitter: @chooyan_i18n ● CodeYourRuby the device powered by Android (but NOT a Smart Phone)
  • 3. Can Android be an HTTP Server? Ordinal architecture Client Server request response
  • 4. Can Android be an HTTP Server? What I would like to discuss today Client Server request response
  • 5. YES! Android CAN be an HTTP Server! ● HTTP is based on TCP ● HTTP is a protocol of “How to Control TCP” ○ See OSI or TCP/IP in detail ● All the OS (as far as I know) can use TCP. It’s the function of OS. ● Android OS also can use TCP ● Thus, Android device can be a HTTP server by extending TCP and implementing the specification on RFC 7230.
  • 6. How to implement? ● Use java.net.ServerSocket ○ Basic class to accept requests based on TCP/IP protocol ○ InputStream and OutputStream of this class presents TCP Socket. ○ See my GitHub repository if you are interested in usage.
  • 7. Flow Image Client Server open socket connect accept GET / HTTP/1.1CRLFUser-Agent: XXXXCRLFCookie:... parse and calculate the end of data. do something... Then, send back response.receive data and parse send data HTTP/1.1 200 OKCRLFContent-Type: text/htmlCRLF... establish connection
  • 8. Demo if app does not work… see below :-( https://www.youtube.com/watch?v=_hZ_UsFKnIU Open the URL below with your favorite web browser :-) http://XXX.XXX.XXX.XXX:20000 https://github.com/chooyan-eng/AndroidHttpServerDemo
  • 9. When to Use? (in my experience) ● Embedded Android (Android on devices for specific operation) ○ Send data DIRECTLY from PC to Android devices via LAN. ○ Send data with TCP connection. (Not using HTTP, but basic idea is the same as discussion here) end data and control the device response