Author Topic: know when complete data is sent..  (Read 10015 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
know when complete data is sent..
« on: June 20, 2010, 02:17:05 PM »
Hi Mark,
  I am using the  Ethernet to send blocks of information, but how do I know when the whole block has physically been sent?

Thanks
Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: know when complete data is sent..
« Reply #1 on: June 20, 2010, 02:42:13 PM »
Hi Neil

When a frame has been sent the interrupt static __interrupt__ void _fec_txf_isr(void) will be called.
This is not used by the driver - just by the optional NetworkIndicator task when LAN_REPORT_ACTIVITY is set.

I think that this is the best place to monitor successful transmission of a tx frame.

Regards

Mark

« Last Edit: June 21, 2010, 01:49:11 PM by mark »

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
Re: know when complete data is sent..
« Reply #2 on: June 20, 2010, 04:29:45 PM »
Hi Mark,
  Thanks for that. If I have say,10 TCP sockets open how do I know which socket its connected to? Is the socket passed ?

Thanks
Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: know when complete data is sent..
« Reply #3 on: June 21, 2010, 12:06:55 AM »
Hi Neil

The frame transmission interrupt has no idea about the frame's use. Therefore it doesn't know whether it is carrying TCP data nor which socket it is associated with.

If you need to know this you will need to add a reference in the TCP socket part which is sending the data (eg. a variable with the socket number that just passed data for transmission). The interrupt can then look at the variable (i.e. the socket that last transmitted something) and then set it to, say -1, to indicate that it has seen this. Since there are multiple tx buffers it may also be necessary to have a queue of corresponding to these because, theoretically, more than one socket could have started transmission before the first frame complete interrupt arrives.

Regards

Mark


Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
Re: know when complete data is sent..
« Reply #4 on: June 21, 2010, 04:31:01 PM »
Hi Mark,
 Thanks for the reply.

One socket will only be sending a maximum of 500 bytes, can I simply detect the TCP_EVENT_ACK in the call back routine to check when block is sent?

Many Thanks
Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: know when complete data is sent..
« Reply #5 on: June 21, 2010, 05:11:27 PM »
Hi Neil

The TCP_EVENT_ACK will be received when data has been acknowledged from the peer. This may be delayed by about 200ms in a local network (due to delayed ack operation) or longer in the Internet.

Regards

Mark