Re: UDP 4 transefer file

From: David Schwartz (davids_at_webmaster.com)
Date: 01/10/04


Date: Fri, 9 Jan 2004 15:19:16 -0800


"Flex" <flexNONSPAMM@REfreemail.it> wrote in message
news:pan.2004.01.09.12.42.34.884450@REfreemail.it...
> Il Fri, 09 Jan 2004 07:49:31 +0000, Flex ha scritto:

>> Please help me,
>> I had to write , in a few days , a UDP protocoll to transfer files
>> between
>> 2 hosts (like TFTP).
>> I'd like to find documentation and example source code .

> I have not understood how can I send information like
> package number or checksum. I must send a record with several fields or
> to put in line

> these information in a header?

    You should lay out each packet byte by byte. For example, you might use
a packet layout as follows:

Bytes 0 through 3, packet sequence number. Starts at zero and increments in
each packet. Unsigned 32-bit integer in network byte order.

Byte 4, packet type. Unsigned integer. Packet types are:

0: Header packet, gives total size of file, filename, and checksum

1: Data packet, contains data from the file

2: Acknowledgement packet, ackwnowledges receipt of packets

    Then go on to define each packet type. Just remember, each side must
keep copies of each packet it has sent until they're acknowledged by the
other side. If too much time passes without an acknowledgement, back up and
start sending again from the first unacknowledged packet.

    If you don't care about performance, then you can get really lazy --
just do this:

    1) Send the next packet

    2) Wait 250 milliseconds or until you receive a packet.

    3) Did you receive an acknowledgement for the packet you sent? If no, go
back to step 1.

    4) Send this packet again. Skip to step 2.

    DS



Relevant Pages

  • Re: Why is this simple addition throwing an overflow exception?
    ... The overflow is occuring when you are attempting to convert the check sum ... 'This routine builds a data packet to send to the remote display ... ' Load the 7 data bytes and the checksum byte into the ...
    (microsoft.public.dotnet.languages.vb)
  • Why is this simple addition throwing an overflow exception?
    ... 'This routine builds a data packet to send to the remote display assembly ... ' Load the 7 data bytes and the checksum byte into the data packet array ...
    (microsoft.public.dotnet.languages.vb)
  • Entirely ignoring TCP and UDP checksum in kernel level
    ... - We have an old network concentrator device in our WAN, ... TCP SYN ACK reply from 192.168.1.1 ... The client from which we send telnet requests to the device gets a packet ... The network concentrator computes the TCP checksum with the source address ...
    (Linux-Kernel)
  • RE: Strange kernel happenings
    ... > packet has arrived intact. ... the ip header check sum covers the ip header only. ... The checksum in the IP header covers the ip header only, ... ICMP has a checksum, which covers the entire ICMP message. ...
    (Incidents)
  • Re: Entirely ignoring TCP and UDP checksum in kernel level
    ... > TCP SYN ACK reply from 192.168.1.1 ... > The client from which we send telnet requests to the device gets a packet ... > The network concentrator computes the TCP checksum with the source address ... > I also investigated terms such as CRC checksum offloading and such, ...
    (Linux-Kernel)