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 / C++ / MFC
  4. Problems with sending UPD Packets over sendto

Problems with sending UPD Packets over sendto

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
9 Posts 4 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.
  • C Offline
    C Offline
    CrazyDogg
    wrote on last edited by
    #1

    Hi @ all, under XP I have the problem sending UDP Packets over the sendto command. Sporadically my client didn´t send the packets. The first time it works fine. I build the packet and then send it with the sendto command. On the second time or more the packet will be created and runs the send command correct. The Remote Port and Address are correct too. But if I protocol these actions with packetyzer or wireshark the sent packet is not displayed anywhere. Anyone here who knows what it could be that the packet will not send? Regards, Karsten

    R S 2 Replies Last reply
    0
    • C CrazyDogg

      Hi @ all, under XP I have the problem sending UDP Packets over the sendto command. Sporadically my client didn´t send the packets. The first time it works fine. I build the packet and then send it with the sendto command. On the second time or more the packet will be created and runs the send command correct. The Remote Port and Address are correct too. But if I protocol these actions with packetyzer or wireshark the sent packet is not displayed anywhere. Anyone here who knows what it could be that the packet will not send? Regards, Karsten

      R Offline
      R Offline
      Rajkumar R
      wrote on last edited by
      #2

      Check the return value of sendto API

      C 1 Reply Last reply
      0
      • C CrazyDogg

        Hi @ all, under XP I have the problem sending UDP Packets over the sendto command. Sporadically my client didn´t send the packets. The first time it works fine. I build the packet and then send it with the sendto command. On the second time or more the packet will be created and runs the send command correct. The Remote Port and Address are correct too. But if I protocol these actions with packetyzer or wireshark the sent packet is not displayed anywhere. Anyone here who knows what it could be that the packet will not send? Regards, Karsten

        S Offline
        S Offline
        Stuart Dootson
        wrote on last edited by
        #3

        UDP will drop packets if you send them too fast - here's a Microsoft article that says as much[^]. Fundamentally, UDP makes no delivery guarantees, so if that's important to you, you either want to think about using TCP (that'd be my choice) or implementing some form of handshaking. I would recommend downloading the IBM TCP/IP Redbook[^] - it's a very useful networking resource.

        C 1 Reply Last reply
        0
        • R Rajkumar R

          Check the return value of sendto API

          C Offline
          C Offline
          CrazyDogg
          wrote on last edited by
          #4

          the return Value is above Zero and the size of command.

          1 Reply Last reply
          0
          • S Stuart Dootson

            UDP will drop packets if you send them too fast - here's a Microsoft article that says as much[^]. Fundamentally, UDP makes no delivery guarantees, so if that's important to you, you either want to think about using TCP (that'd be my choice) or implementing some form of handshaking. I would recommend downloading the IBM TCP/IP Redbook[^] - it's a very useful networking resource.

            C Offline
            C Offline
            CrazyDogg
            wrote on last edited by
            #5

            But under Vista it works correctly. And I send SIP Packets above the UDP Socket. I can´t use TCP because it´s a realtime ip phone I programm.

            D 1 Reply Last reply
            0
            • C CrazyDogg

              But under Vista it works correctly. And I send SIP Packets above the UDP Socket. I can´t use TCP because it´s a realtime ip phone I programm.

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              CrazyDogg wrote:

              But under Vista it works correctly.

              Which means it's likely a coincidence.

              CrazyDogg wrote:

              I can´t use TCP because it´s a realtime ip phone I programm.

              Then it'll be up to you to code the handshaking.

              "Love people and use things, not love things and use people." - Unknown

              "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

              C 1 Reply Last reply
              0
              • D David Crow

                CrazyDogg wrote:

                But under Vista it works correctly.

                Which means it's likely a coincidence.

                CrazyDogg wrote:

                I can´t use TCP because it´s a realtime ip phone I programm.

                Then it'll be up to you to code the handshaking.

                "Love people and use things, not love things and use people." - Unknown

                "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                C Offline
                C Offline
                CrazyDogg
                wrote on last edited by
                #7

                How to code a handshaking for this? I have never done this.

                D 1 Reply Last reply
                0
                • C CrazyDogg

                  How to code a handshaking for this? I have never done this.

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  CrazyDogg wrote:

                  How to code a handshaking for this?

                  However you want to. It's just extra information (usually a CRC) that the send adds to the packet at a specific location (e.g., front, back). The receiver looks at that spot to know if all of the packet has been received. If so, an ACK of some sort is sent back.

                  "Love people and use things, not love things and use people." - Unknown

                  "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                  C 1 Reply Last reply
                  0
                  • D David Crow

                    CrazyDogg wrote:

                    How to code a handshaking for this?

                    However you want to. It's just extra information (usually a CRC) that the send adds to the packet at a specific location (e.g., front, back). The receiver looks at that spot to know if all of the packet has been received. If so, an ACK of some sort is sent back.

                    "Love people and use things, not love things and use people." - Unknown

                    "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                    C Offline
                    C Offline
                    CrazyDogg
                    wrote on last edited by
                    #9

                    I think it is impossible to made a handshake for this because I just code the client. The server is an asterisk server and I have no rights to change anything.

                    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