SlideShare a Scribd company logo
1 of 11
Developing a lightweight, hi-performance and dynamic JSON api server with C ,[object Object],[object Object],[object Object]
Background
Play Tools PHP Java Python C
WHY!!
Requirement http://myserver.com:8080 ? mod =score& action =get_score& id =123 ,[object Object],[object Object],[object Object],[object Object]
The Server if (  (client_socket=accept(server_socket, (struct sockaddr *)&cad, &alen)) < 0) { printf(&quot;accept failed&quot;); exit (1); } pthread_create(&tid, NULL, serverthread, (void*)client_socket ); While(1){ } accept connection from client run a thread to process
Processing Request Read all available data recv(client_socket, buffer,buffer_size, 0);
Processing Request Host:  www.http.header.free.fr Accept: image/gif, image/x-xbitmap, image/jpeg, imagepjpeg, Accept-Language: Fr Accept - Encoding: gzip, deflate Get the request params mod =score& action =get_score& id =123 GET: Http1.1
Calling Dynamic Function PIC : Position Independent Code dlopen(PATH, mode) dlsym(handle, fun_name) void  (*fn)( int * cs,cJSON** js); void   echo_name ( int * client_socket, cJSON** request)
Demo
QnA

More Related Content

What's hot

Node js presentation
Node js presentationNode js presentation
Node js presentationmartincabrera
 
Socket Programming it-slideshares.blogspot.com
Socket  Programming it-slideshares.blogspot.comSocket  Programming it-slideshares.blogspot.com
Socket Programming it-slideshares.blogspot.comphanleson
 
PL/Perl - New Features in PostgreSQL 9.0
PL/Perl - New Features in PostgreSQL 9.0PL/Perl - New Features in PostgreSQL 9.0
PL/Perl - New Features in PostgreSQL 9.0Tim Bunce
 
Laporan tugas network programming
Laporan tugas network programmingLaporan tugas network programming
Laporan tugas network programmingRahmatHamdani2
 
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...NoNameCon
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueGleicon Moraes
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUNCong Zhang
 
Raymond Kuiper - Working the API like a Unix Pro
Raymond Kuiper - Working the API like a Unix ProRaymond Kuiper - Working the API like a Unix Pro
Raymond Kuiper - Working the API like a Unix ProZabbix
 
Top 10 Perl Performance Tips
Top 10 Perl Performance TipsTop 10 Perl Performance Tips
Top 10 Perl Performance TipsPerrin Harkins
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webclkao
 
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Codemotion
 
Ethernet Shield
Ethernet ShieldEthernet Shield
Ethernet ShieldTinker
 
Socket Programming
Socket ProgrammingSocket Programming
Socket ProgrammingMostak Ahmed
 
Redis as a message queue
Redis as a message queueRedis as a message queue
Redis as a message queueBrandon Lamb
 
Socket programming-tutorial-sk
Socket programming-tutorial-skSocket programming-tutorial-sk
Socket programming-tutorial-sksureshkarthick37
 

What's hot (20)

Node js presentation
Node js presentationNode js presentation
Node js presentation
 
Socket Programming it-slideshares.blogspot.com
Socket  Programming it-slideshares.blogspot.comSocket  Programming it-slideshares.blogspot.com
Socket Programming it-slideshares.blogspot.com
 
PL/Perl - New Features in PostgreSQL 9.0
PL/Perl - New Features in PostgreSQL 9.0PL/Perl - New Features in PostgreSQL 9.0
PL/Perl - New Features in PostgreSQL 9.0
 
Socket programing
Socket programingSocket programing
Socket programing
 
Laporan tugas network programming
Laporan tugas network programmingLaporan tugas network programming
Laporan tugas network programming
 
Node.js - Best practices
Node.js  - Best practicesNode.js  - Best practices
Node.js - Best practices
 
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...
Help, my browser is leaking! Exploring XSLeaks attacks and defenses - Tom Van...
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
 
T2
T2T2
T2
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
Raymond Kuiper - Working the API like a Unix Pro
Raymond Kuiper - Working the API like a Unix ProRaymond Kuiper - Working the API like a Unix Pro
Raymond Kuiper - Working the API like a Unix Pro
 
Top 10 Perl Performance Tips
Top 10 Perl Performance TipsTop 10 Perl Performance Tips
Top 10 Perl Performance Tips
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
 
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
 
Ethernet Shield
Ethernet ShieldEthernet Shield
Ethernet Shield
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
 
Redis as a message queue
Redis as a message queueRedis as a message queue
Redis as a message queue
 
Socket programming-tutorial-sk
Socket programming-tutorial-skSocket programming-tutorial-sk
Socket programming-tutorial-sk
 
Everything as Code with Terraform
Everything as Code with TerraformEverything as Code with Terraform
Everything as Code with Terraform
 
About Data::ObjectDriver
About Data::ObjectDriverAbout Data::ObjectDriver
About Data::ObjectDriver
 

Viewers also liked

Selenium - what it is and what you can do with it
Selenium - what it is and what you can do with itSelenium - what it is and what you can do with it
Selenium - what it is and what you can do with itDavid Stark
 
Shoeb: Implementation Challenges of a Paperless Admission System
Shoeb: Implementation Challenges of a Paperless Admission SystemShoeb: Implementation Challenges of a Paperless Admission System
Shoeb: Implementation Challenges of a Paperless Admission SystemSQABD
 
Hasin: Bangla Input Manager jQuery Plugin
Hasin: Bangla Input Manager jQuery PluginHasin: Bangla Input Manager jQuery Plugin
Hasin: Bangla Input Manager jQuery PluginSQABD
 
Imrul: Context Driven Testing
Imrul: Context Driven TestingImrul: Context Driven Testing
Imrul: Context Driven TestingSQABD
 
Tanvir Afzal: Selenium
Tanvir Afzal: SeleniumTanvir Afzal: Selenium
Tanvir Afzal: SeleniumSQABD
 
Zahidul: Meta Testing
Zahidul: Meta TestingZahidul: Meta Testing
Zahidul: Meta TestingSQABD
 

Viewers also liked (7)

Selenium.ppt
Selenium.pptSelenium.ppt
Selenium.ppt
 
Selenium - what it is and what you can do with it
Selenium - what it is and what you can do with itSelenium - what it is and what you can do with it
Selenium - what it is and what you can do with it
 
Shoeb: Implementation Challenges of a Paperless Admission System
Shoeb: Implementation Challenges of a Paperless Admission SystemShoeb: Implementation Challenges of a Paperless Admission System
Shoeb: Implementation Challenges of a Paperless Admission System
 
Hasin: Bangla Input Manager jQuery Plugin
Hasin: Bangla Input Manager jQuery PluginHasin: Bangla Input Manager jQuery Plugin
Hasin: Bangla Input Manager jQuery Plugin
 
Imrul: Context Driven Testing
Imrul: Context Driven TestingImrul: Context Driven Testing
Imrul: Context Driven Testing
 
Tanvir Afzal: Selenium
Tanvir Afzal: SeleniumTanvir Afzal: Selenium
Tanvir Afzal: Selenium
 
Zahidul: Meta Testing
Zahidul: Meta TestingZahidul: Meta Testing
Zahidul: Meta Testing
 

Similar to Aman: Developing a lightweight, hi-performance and dynamic JSON api server with C

Http capturing
Http capturingHttp capturing
Http capturingEric Ahn
 
Scalable Socket Server by Aryo
Scalable Socket Server by AryoScalable Socket Server by Aryo
Scalable Socket Server by AryoAgate Studio
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Masahiro Nagano
 
Rpi python web
Rpi python webRpi python web
Rpi python websewoo lee
 
Implementing Comet using PHP
Implementing Comet using PHPImplementing Comet using PHP
Implementing Comet using PHPKing Foo
 
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
 
Networks lab
Networks labNetworks lab
Networks labsvijiiii
 
Networks lab
Networks labNetworks lab
Networks labsvijiiii
 
Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8shanmuga priya
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming TutorialJignesh Patel
 
Amazon Web Service - Basics
Amazon Web Service - BasicsAmazon Web Service - Basics
Amazon Web Service - BasicsSang-Min Park
 
Ruby C10K: High Performance Networking - RubyKaigi '09
Ruby C10K: High Performance Networking - RubyKaigi '09Ruby C10K: High Performance Networking - RubyKaigi '09
Ruby C10K: High Performance Networking - RubyKaigi '09Ilya Grigorik
 
Under the Covers with the Web
Under the Covers with the WebUnder the Covers with the Web
Under the Covers with the WebTrevor Lohrbeer
 
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
 
php & performance
 php & performance php & performance
php & performancesimon8410
 

Similar to Aman: Developing a lightweight, hi-performance and dynamic JSON api server with C (20)

Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 
Http capturing
Http capturingHttp capturing
Http capturing
 
Pemrograman Jaringan
Pemrograman JaringanPemrograman Jaringan
Pemrograman Jaringan
 
Scalable Socket Server by Aryo
Scalable Socket Server by AryoScalable Socket Server by Aryo
Scalable Socket Server by Aryo
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
 
Rpi python web
Rpi python webRpi python web
Rpi python web
 
Implementing Comet using PHP
Implementing Comet using PHPImplementing Comet using PHP
Implementing Comet using PHP
 
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
 
Networks lab
Networks labNetworks lab
Networks lab
 
Networks lab
Networks labNetworks lab
Networks lab
 
Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8Socket Programming Tutorial 1227317798640739 8
Socket Programming Tutorial 1227317798640739 8
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming Tutorial
 
Amazon Web Service - Basics
Amazon Web Service - BasicsAmazon Web Service - Basics
Amazon Web Service - Basics
 
Ruby C10K: High Performance Networking - RubyKaigi '09
Ruby C10K: High Performance Networking - RubyKaigi '09Ruby C10K: High Performance Networking - RubyKaigi '09
Ruby C10K: High Performance Networking - RubyKaigi '09
 
PPT
PPTPPT
PPT
 
Under the Covers with the Web
Under the Covers with the WebUnder the Covers with the Web
Under the Covers with the Web
 
Web Server.pdf
Web Server.pdfWeb Server.pdf
Web Server.pdf
 
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
 
php & performance
 php & performance php & performance
php & performance
 
Server architecture
Server architectureServer architecture
Server architecture
 

More from SQABD

Rabbi: Good to Great
Rabbi: Good to GreatRabbi: Good to Great
Rabbi: Good to GreatSQABD
 
Tauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change AutomationTauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change AutomationSQABD
 
Ayman: When to stop testing?
Ayman: When to stop testing?Ayman: When to stop testing?
Ayman: When to stop testing?SQABD
 
Mozammel: Solo Scrum - The Pomodoro Technique
Mozammel: Solo Scrum - The Pomodoro TechniqueMozammel: Solo Scrum - The Pomodoro Technique
Mozammel: Solo Scrum - The Pomodoro TechniqueSQABD
 
Hasan: Whats preventing me to write nearly accurate code
Hasan: Whats preventing me to write nearly accurate codeHasan: Whats preventing me to write nearly accurate code
Hasan: Whats preventing me to write nearly accurate codeSQABD
 
Kabir Ahmed: AutoHotkey
Kabir Ahmed: AutoHotkeyKabir Ahmed: AutoHotkey
Kabir Ahmed: AutoHotkeySQABD
 
Mozammel Haque: Git -- Stupid, Fast, distributed content tracker
Mozammel Haque: Git -- Stupid, Fast, distributed content trackerMozammel Haque: Git -- Stupid, Fast, distributed content tracker
Mozammel Haque: Git -- Stupid, Fast, distributed content trackerSQABD
 
M. Ayman Noor: SQA Empowerment
M. Ayman Noor: SQA EmpowermentM. Ayman Noor: SQA Empowerment
M. Ayman Noor: SQA EmpowermentSQABD
 
Shimul: Testing Mnemonics
Shimul: Testing MnemonicsShimul: Testing Mnemonics
Shimul: Testing MnemonicsSQABD
 
Jan Friis Nielson: Bideshi Experience
Jan Friis Nielson: Bideshi ExperienceJan Friis Nielson: Bideshi Experience
Jan Friis Nielson: Bideshi ExperienceSQABD
 
Hasin Hayder: Motivated team and getting most out of it
Hasin Hayder: Motivated team and getting most out of itHasin Hayder: Motivated team and getting most out of it
Hasin Hayder: Motivated team and getting most out of itSQABD
 
Mozammel Haque: Scrum
Mozammel Haque: ScrumMozammel Haque: Scrum
Mozammel Haque: ScrumSQABD
 
Innovation Stories of Test Toolsmiths
Innovation Stories of Test ToolsmithsInnovation Stories of Test Toolsmiths
Innovation Stories of Test ToolsmithsSQABD
 
CUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunCUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunSQABD
 
Code Review In Testing View
Code Review In Testing ViewCode Review In Testing View
Code Review In Testing ViewSQABD
 
Am I Flexible?
Am I Flexible?Am I Flexible?
Am I Flexible?SQABD
 
SCALING Scrum
SCALING ScrumSCALING Scrum
SCALING ScrumSQABD
 
Do You Have a Hit List?
Do You Have a Hit List?Do You Have a Hit List?
Do You Have a Hit List?SQABD
 
Challenges in Embedded Development
Challenges in Embedded DevelopmentChallenges in Embedded Development
Challenges in Embedded DevelopmentSQABD
 

More from SQABD (19)

Rabbi: Good to Great
Rabbi: Good to GreatRabbi: Good to Great
Rabbi: Good to Great
 
Tauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change AutomationTauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change Automation
 
Ayman: When to stop testing?
Ayman: When to stop testing?Ayman: When to stop testing?
Ayman: When to stop testing?
 
Mozammel: Solo Scrum - The Pomodoro Technique
Mozammel: Solo Scrum - The Pomodoro TechniqueMozammel: Solo Scrum - The Pomodoro Technique
Mozammel: Solo Scrum - The Pomodoro Technique
 
Hasan: Whats preventing me to write nearly accurate code
Hasan: Whats preventing me to write nearly accurate codeHasan: Whats preventing me to write nearly accurate code
Hasan: Whats preventing me to write nearly accurate code
 
Kabir Ahmed: AutoHotkey
Kabir Ahmed: AutoHotkeyKabir Ahmed: AutoHotkey
Kabir Ahmed: AutoHotkey
 
Mozammel Haque: Git -- Stupid, Fast, distributed content tracker
Mozammel Haque: Git -- Stupid, Fast, distributed content trackerMozammel Haque: Git -- Stupid, Fast, distributed content tracker
Mozammel Haque: Git -- Stupid, Fast, distributed content tracker
 
M. Ayman Noor: SQA Empowerment
M. Ayman Noor: SQA EmpowermentM. Ayman Noor: SQA Empowerment
M. Ayman Noor: SQA Empowerment
 
Shimul: Testing Mnemonics
Shimul: Testing MnemonicsShimul: Testing Mnemonics
Shimul: Testing Mnemonics
 
Jan Friis Nielson: Bideshi Experience
Jan Friis Nielson: Bideshi ExperienceJan Friis Nielson: Bideshi Experience
Jan Friis Nielson: Bideshi Experience
 
Hasin Hayder: Motivated team and getting most out of it
Hasin Hayder: Motivated team and getting most out of itHasin Hayder: Motivated team and getting most out of it
Hasin Hayder: Motivated team and getting most out of it
 
Mozammel Haque: Scrum
Mozammel Haque: ScrumMozammel Haque: Scrum
Mozammel Haque: Scrum
 
Innovation Stories of Test Toolsmiths
Innovation Stories of Test ToolsmithsInnovation Stories of Test Toolsmiths
Innovation Stories of Test Toolsmiths
 
CUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunCUCUMBER - Making BDD Fun
CUCUMBER - Making BDD Fun
 
Code Review In Testing View
Code Review In Testing ViewCode Review In Testing View
Code Review In Testing View
 
Am I Flexible?
Am I Flexible?Am I Flexible?
Am I Flexible?
 
SCALING Scrum
SCALING ScrumSCALING Scrum
SCALING Scrum
 
Do You Have a Hit List?
Do You Have a Hit List?Do You Have a Hit List?
Do You Have a Hit List?
 
Challenges in Embedded Development
Challenges in Embedded DevelopmentChallenges in Embedded Development
Challenges in Embedded Development
 

Aman: Developing a lightweight, hi-performance and dynamic JSON api server with C

  • 1.
  • 3. Play Tools PHP Java Python C
  • 5.
  • 6. The Server if ( (client_socket=accept(server_socket, (struct sockaddr *)&cad, &alen)) < 0) { printf(&quot;accept failed&quot;); exit (1); } pthread_create(&tid, NULL, serverthread, (void*)client_socket ); While(1){ } accept connection from client run a thread to process
  • 7. Processing Request Read all available data recv(client_socket, buffer,buffer_size, 0);
  • 8. Processing Request Host: www.http.header.free.fr Accept: image/gif, image/x-xbitmap, image/jpeg, imagepjpeg, Accept-Language: Fr Accept - Encoding: gzip, deflate Get the request params mod =score& action =get_score& id =123 GET: Http1.1
  • 9. Calling Dynamic Function PIC : Position Independent Code dlopen(PATH, mode) dlsym(handle, fun_name) void (*fn)( int * cs,cJSON** js); void echo_name ( int * client_socket, cJSON** request)
  • 10. Demo
  • 11. QnA