SFS2X Docs / Overview / sfs2x-protocol
» The SmartFoxServer 2X protocol
SmartFoxServer 2X employs an efficient binary protocol with support for LZW compression and TSL 1.2 encryption. A lightweight protocol codec allows the server to process tens of thousands of packets even on a low spec machine, such as an old Intel Core Duo cpu, allowing lightning fast performance on modern, multi-cpu hardware.
The protocol can be transmitted via a number of transports such as:
- Raw TCP and UDP sockets
- HTTP Tunnel
» Clients and transport types
Depending on the client platform in use we support a variety of different transports. The table below recapitulates the options available for every supported client technology:
|TCP socket||UDP socket||HTTP tunnel||Websocket|
|Adobe Air publishing|
|iOS / macOS / tvOS|
|Android / Java2 SE|
» TCP and UDP socket
This is the default and recommended modality for most client platforms such as Unity, Flash, Java/Android, iOS, etc. The client establishes a direct TCP connection to the server (default port = 9933) that lasts for the entire game session. Additionally the application can also send data via UDP for faster response times.
From the SFS2X Administration Tool, under the Server Configurator > General tab, it is possible to add any number of TCP and UDP listeners in the server.
» HTTP Tunnel (BlueBox)
The HTTP Tunnel solution offered by SmartFoxServer 2X is called BlueBox and it is a failover technology for clients unable to use TCP sockets. The client API can automatically revert to an HTTP-based connection that acts as a tunnel for the standard SFS2X protocol (including TLS encryption).
This way players behind a firewall or proxy can still enjoy online multiplayer games at a moderate performance cost. Even most real-time games should remain playable in this context since the BlueBox offers a series of optimizations to compensate the added latency of the HTTP-based solution.
The BlueBox requires the internal web server to be active and properly configured in the Administration Tool's Server Configurator > Web Server tab.
To learn more about the BlueBox, we recommend this article.
SmartFoxServer 2X provides full support for websockets in both standard (WS) and secure form (WSS) via the internal web server, which is tightly integrated with SFS2X engine.