Chapter 18. A chat app using sockets
This chapter covers
- Creating a socket server
- Connecting to a socket server
- Using TCP and UDP sockets
Higher-level networking approaches such as SOAP and RESTful services are great when you don’t need to count milliseconds or when communication is primarily one way. But what about those times when you need to perform near real-time control of, say, a robot? How about synchronizing character or object movement for a game? Those are all performance-critical, often bidirectional, and sometimes peer-to-peer communications scenarios.
When apps need to communicate across a network as quickly and efficiently as possible, they use sockets. Socket communication is two-way communication between, in most cases, ...