Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. UdpClient class

UdpClient class

Scheduled Pinned Locked Moved C#
questionsysadminlounge
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zishan Haider
    wrote on last edited by
    #1

    My chat application uses UdpClient class. It is working fine on LAN as well as over the internet. I can not recieve messages in one senerio, when I send message over the internet and the receiving party is indirectly connected to the internet like using a shared internet connection over LAN. How do I reach those clients? There is no server program and both parties are connected directly through IPs. Regards

    D 1 Reply Last reply
    0
    • Z Zishan Haider

      My chat application uses UdpClient class. It is working fine on LAN as well as over the internet. I can not recieve messages in one senerio, when I send message over the internet and the receiving party is indirectly connected to the internet like using a shared internet connection over LAN. How do I reach those clients? There is no server program and both parties are connected directly through IPs. Regards

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Your probably talking about the common situation where each machine is sitting behind a router/NAT/Firewall. In this case, your application doesn't do anything different. Each user must change the configuration of their NAT/Firewall to forward the port that your chat program is using to the machine's local IP address, usually on the 192.168.x.x network. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      Z 3 Replies Last reply
      0
      • D Dave Kreskowiak

        Your probably talking about the common situation where each machine is sitting behind a router/NAT/Firewall. In this case, your application doesn't do anything different. Each user must change the configuration of their NAT/Firewall to forward the port that your chat program is using to the machine's local IP address, usually on the 192.168.x.x network. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        Z Offline
        Z Offline
        Zishan Haider
        wrote on last edited by
        #3

        Thanks for the reply. Ok you got it right.. my client has a local IP address 192.168.x.x. How do I change the configuration of NAT to forward the port?? Regards

        D 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Your probably talking about the common situation where each machine is sitting behind a router/NAT/Firewall. In this case, your application doesn't do anything different. Each user must change the configuration of their NAT/Firewall to forward the port that your chat program is using to the machine's local IP address, usually on the 192.168.x.x network. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          Z Offline
          Z Offline
          Zishan Haider
          wrote on last edited by
          #4

          One thing more... Udp being connectionless, the client at the other end is just sending messages to the public IP. How does it know that the message has to be forwarded to the 192.168.0.34 ?? There has be to some information at the sending end that the message is for 192.168.0.34 (local) on 205.166.6.33 (public IP) I am so confused :confused:

          D 1 Reply Last reply
          0
          • Z Zishan Haider

            Thanks for the reply. Ok you got it right.. my client has a local IP address 192.168.x.x. How do I change the configuration of NAT to forward the port?? Regards

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            That's up to each individual router. You really can't do that in your code without writing a version for each manufacturer and different models of routers. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            1 Reply Last reply
            0
            • Z Zishan Haider

              One thing more... Udp being connectionless, the client at the other end is just sending messages to the public IP. How does it know that the message has to be forwarded to the 192.168.0.34 ?? There has be to some information at the sending end that the message is for 192.168.0.34 (local) on 205.166.6.33 (public IP) I am so confused :confused:

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Your actually sending to a specific port at an IP address, not just to the IP address alone. The router has a table that tells it where to forward individual ports to local IP addresses. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

              1 Reply Last reply
              0
              • D Dave Kreskowiak

                Your probably talking about the common situation where each machine is sitting behind a router/NAT/Firewall. In this case, your application doesn't do anything different. Each user must change the configuration of their NAT/Firewall to forward the port that your chat program is using to the machine's local IP address, usually on the 192.168.x.x network. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                Z Offline
                Z Offline
                Zishan Haider
                wrote on last edited by
                #7

                Thanks Dave. The problem is now solved.. I configured the NAT settings.. ;)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups