Gillius's Programming Forums

Programming => GNE Library => Topic started by: dragonmage on June 13, 2007, 05:04:26 AM

Title: switching from tcp to udp
Post by: dragonmage on June 13, 2007, 05:04:26 AM
Hi,

I was wondering about switching from tcp/ip to udp on same port.
i.e. I setup tcp/ip and exchange initial messages. Then one of the
agents opens a new udp socket on same port to write udp messages and the other opens up
a new udp socket on same port to receive the messages.

Are the likely to be problems doing this?

thx,

chris
Title: Re: switching from tcp to udp
Post by: Gillius on June 13, 2007, 03:53:47 PM
Ports are a concept of UDP and TCP separately and not a "global" concept. What I mean here is that TCP port 12345 is not related in any way to UDP port 12345, because UDP and TCP are different protocols over the IP layer. In that sense anything you do with TCP won't affect anything to do with UDP. To answer your specific question, no, there won't be a problem. However, you may want to negotiate ports instead of "using the same port" in case the UDP port you want is already in use by some other application (including a still open instance of the same app, or a crashed version of an old instance that hasn't cleaned up yet).
Title: Re: switching from tcp to udp
Post by: dragonmage on June 13, 2007, 11:03:51 PM
Great, thanks for explaining that.