Re: UDP or TCP?
- From: "RussH" <russ@xxxxxxxxxxxxx>
- Date: Fri, 18 Aug 2006 17:33:10 -0600
Could someone give me direction on where to go if i would like to make
a network chat program for multiple users to use. Ive thought about tcp
but then again i know udp is more like a mass message to all connected
clients. so i was thinking that would be best. so if someone could
explain to me how to get started with that or even if you have input on
it. please if you could help that would be great. thankyou.
The thing with TCP is that it's strictly a two-party "connection-oriented"
protocol.
There are exactly two participants in a connection, usually known as
"client" and
"server". If you want multiple-person "chat", you have to create a server
program that
each client program connects with separately. The function of the server is
to relay each
incoming message, from any client, to all the other clients. This is how
most chat programs
work that use the internet. The devil's in the details, of course. That's
why people
take a little time to invent protocols.
You can use UDP "broadcast" mode to dispense with the central server
program, but you're limited to
conversations taking place over a single LAN connection, not the Internet at
large.
UDP broadcast is created by using the IP address of 255.255.255.255 as the
destination address
of each message sent. You pick a port number and then your chat program can
send everything
to that port number, using the broadcast IP address. Any program "listening"
on that port will get
the message. You have to pick a port number that won't conflict with any of
the standard ones used
for "serious" protocols. There is no privacy with this approach, because
anyone can run a program
that listens to any port, and you can't even tell they're doing it, but it's
simple and fun for your home
network.
Use the Winsock control to accomplish either of these.
.
- References:
- UDP or TCP?
- From: Brandon Johnson
- UDP or TCP?
- Prev by Date: Re: VB - SQL - Read - Write
- Previous by thread: UDP or TCP?
- Next by thread: RE: How to fix the width of the Dashboard ?
- Index(es):
Relevant Pages
|