UDP problem when datagram's size increases - Programmer

This is a discussion on UDP problem when datagram's size increases - Programmer ; Hi, I have downloaded two simple programs, one for sending UDP datagrams and one for listening for UDP datagrams. The original progams was quite simple, and only sent a single packet to the receiver, after which both terminated. I modified ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: UDP problem when datagram's size increases

  1. UDP problem when datagram's size increases

    Hi,

    I have downloaded two simple programs, one for sending UDP datagrams
    and one for listening for UDP datagrams. The original progams was
    quite simple, and only sent a single packet to the receiver, after
    which both terminated. I modified the programs by putting in a for
    loop in the sending program so that it would send more than one
    packet. I fixed the receiver with an endless while loop, not the best
    way, but I was a bit lazy ...

    The problem that I have is that when the UPD data packet's size
    increases from one iteration to the next, the receiving program
    terminates with an error. (10040 or something)

    The sending program use sendto and the receiver recvfrom. (I can give
    the source code if someone wants to have a look... )

    Your time, effort and suggestions will be greatly appreciated
    Jaco

  2. Re: UDP problem when datagram's size increases

    jaco_versfeld@hotmail.com (Jaco Versfeld) writes:

    > I have downloaded two simple programs, one for sending UDP datagrams
    > and one for listening for UDP datagrams. The original progams was
    > quite simple, and only sent a single packet to the receiver, after
    > which both terminated. I modified the programs by putting in a for
    > loop in the sending program so that it would send more than one
    > packet. I fixed the receiver with an endless while loop, not the best
    > way, but I was a bit lazy ...
    >
    > The problem that I have is that when the UPD data packet's size
    > increases from one iteration to the next, the receiving program
    > terminates with an error. (10040 or something)


    Is the receiving program's buffer big enough?

    > The sending program use sendto and the receiver recvfrom. (I can give
    > the source code if someone wants to have a look... )
    >
    > Your time, effort and suggestions will be greatly appreciated
    > Jaco


    Ciao,

    Peter K.

    --
    Peter J. Kootsookos

    "I will ignore all ideas for new works [..], the invention of which
    has reached its limits and for whose improvement I see no further
    hope."

    - Julius Frontinus, c. AD 84

  3. Re: UDP problem when datagram's size increases

    Thanks a lot.

    The code used the same variable for input for the length of the buffer
    to receive and after receiving the message stored the length of the
    received message...

    Thanks again
    Jaco


    p.kootsookos@remove.ieee.org (Peter J. Kootsookos) wrote in message news:...
    > jaco_versfeld@hotmail.com (Jaco Versfeld) writes:
    >
    > > I have downloaded two simple programs, one for sending UDP datagrams
    > > and one for listening for UDP datagrams. The original progams was
    > > quite simple, and only sent a single packet to the receiver, after
    > > which both terminated. I modified the programs by putting in a for
    > > loop in the sending program so that it would send more than one
    > > packet. I fixed the receiver with an endless while loop, not the best
    > > way, but I was a bit lazy ...
    > >
    > > The problem that I have is that when the UPD data packet's size
    > > increases from one iteration to the next, the receiving program
    > > terminates with an error. (10040 or something)

    >
    > Is the receiving program's buffer big enough?
    >
    > > The sending program use sendto and the receiver recvfrom. (I can give
    > > the source code if someone wants to have a look... )
    > >
    > > Your time, effort and suggestions will be greatly appreciated
    > > Jaco

    >
    > Ciao,
    >
    > Peter K.


  4. Re: UDP problem when datagram's size increases

    "Jaco Versfeld" schrieb
    >
    > The problem that I have is that when the UPD data packet's size
    > increases from one iteration to the next, the receiving program
    > terminates with an error. (10040 or something)
    >

    This code runs - or rather doesn't run :-( - on Windows, right?
    Error 10040 translates to WSAEMSGSIZE.

    My Windows SDK help page for recvfrom tells me:

    ....
    For message-oriented sockets, data is extracted from the first
    enqueued message, up to the size of the buffer supplied. If the
    datagram or message is larger than the buffer supplied, the buffer
    is filled with the first part of the datagram, and recvfrom
    generates the error WSAEMSGSIZE. For unreliable protocols (for
    example, UDP) the excess data is lost.
    ....

    Perhaps your sender's and receiver's opinions of how much data
    should be sent / received get out of synch? (If you dynamically
    allocate a recv buffer).


    HTH
    Martin




+ Reply to Thread