How do I use a UDP socket to LAN a game?
-
Hello!
I have created an air hockey game as an assignment, but now have received a new assignment to take that game and LAN it between two computers.
We are allowed to make the two IP adresses fixed adresses.
Can anyone please push me into the right direction? -
I suggest use TCP instead. UDP is unreliable.
-
As soroush already suggested TCP is probably better than UDP. Especially if you have dedicated connections. TCP makes sure that the information is being received.
UDP is for broadcasting from one server to a number of clients, but it does not care that the info is really received.
If you are looking for a start, there are "the network examples.":https://qt-project.org/doc/qt-4.8/examples-network.html
A good start are the "fortune server":https://qt-project.org/doc/qt-4.8/network-fortuneserver.html and the "fortune client":https://qt-project.org/doc/qt-4.8/network-fortuneclient.html examples.