Just a summary for you,
With TCP/IP, you actually establish a connection between sender and
receiver. Each packet sent is ACK’d by the recipient - if the ack doesn’t
come back, TCP/IP automatically resends it for you. It provides
reliaibility at the expence of latency. This is why many games use UDP
rather than TCP/IP.
UDP is a bit different. Packets are sent but not acked. Depending on
network routing and other issues, they may not arrive… or may even
arrive but out of order.
UDP has much less latency because it doesn’t send/wait for acks/etc. But
you’ll probably have to build some sort of sequencing into it to handle
For example, say you send packets for a ship flying across the screen,
updating it’s position. If you move the ship in three steps and the
center step is lost, it doesn’t really matter - the third packet updates
them to the correct spot anyway. But if it were TCP/IP, the error
correction layer would have resent and added a delay that keeps the
client and server(or client) a bit more out of sync.
In such a situation, losing a packet isn’t a big deal - but it would be
important to make sure you get them in order. So you’d have to install
your own sequence error correcting. But you’d gain greatly in the latency
This latency issue is more important for continuously moving, high-speed
action based games, space ships flying across the screen… characters
jumping, running fast, etc. If you have something with granularized
slower paced actions TCP/IP may be sufficient.
As far as books on TCP/IP. I’d strongly suggest an O’Reilly book. I
believe the System V Programming book covers network programming. I’m not
sure if their “TCP/IP in a nutshell” book covers the programming side or
not, or just “systems networking”.–
Here is a question that probebly does not belong in this group and I
appologize if that is the case.
I have been looking at SDL_net and the thing I don’t understand is what is
the difference between TCP and UDP. I know that udp is firewall unfriendly
for the most part. But I was actually looking for more of an architecture
answer. Also is it possible to create ip-to-ip connections using TCP
of UDP for a game with good results.
ps Also if possible could anybody let me know where I could find some docs
on TCP and UDP coding. Thanks