Networking in Swingame allows you to write programs that can send messages to other programs.
It uses either the TCP or UDP protocol, and function in a similar manner within SwinGame.. The main steps of networking are:
- Send Message
Connections are created by connecting to a Host, or when a client has connected to the Host. These Connections are added to a new connection queue and need to be fetched, removing them from the queue and returning them, so that you can assign them locally. Generally, the steps to connect involve :
- Host Listens for connections
- Client connects to host (returns a Connection)
- Host accepts the connection (Adds the connection to the queue).
- TCP: If the messages MUST be delivierd (Example. Chat Program).
- UDP: If it is ok that some messages are not delivered (Example. A Game that sends coordinates, and only the latest is relevant).