Author Topic: switching from tcp to udp  (Read 3841 times)

dragonmage

  • User
  • *
  • Posts: 2
switching from tcp to udp
« 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

Gillius

  • Administrator
  • User
  • *****
  • Posts: 147
    • http://www.gillius.org/
Re: switching from tcp to udp
« Reply #1 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).
Gillius
Gillius's Programming http://www.gillius.org/

dragonmage

  • User
  • *
  • Posts: 2
Re: switching from tcp to udp
« Reply #2 on: June 13, 2007, 11:03:51 PM »
Great, thanks for explaining that.