Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
SFML Blueprints

You're reading from   SFML Blueprints Sharpen your game development skills and improve your C++ and SFML knowledge with five exciting projects

Arrow left icon
Product type Paperback
Published in May 2015
Publisher Packt
ISBN-13 9781784398477
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Network communication using sockets


To be able to interact with other players, we will need a way to communicate with them, regardless of the architecture used. To be able to communicate with any computer, we have to use sockets. In short, a socket enables communication with other processes/computers through the network as long as there is an existing way between both sides (LAN or Internet). There are two main kinds of sockets: non-connected (UDP) or connected (TCP). Both these need an IP address and a port number to communicate with their destination.

Notice that the number of available ports on a computer is contained between 0 and 65535. A piece of advice is to avoid the use of ports with a number lesser than 1024. The reason is that most of them are reserved by the system or used by common applications, such as 80 for a web browser, 21 for FTP, and so on. You also have to ensure that both sides of the communication use the same port number to be able to exchange data. Let's now see in...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime