1

This is a continuation of Sending and receiving data streams in Delphi.

I am going to send an image using TCP/IP and then going to update the changes in that image using UDP by dividing the picture in to small pieces and sending only the pieces that are having major changes then the client will patch those pieces on the old picture.

every 15 seconds the whole image is updated using TCP/IP.

The picture in server will be updated by webcam. (Like a video Stream).I have already created a motion detector and piece collector in delphi which are working perfectly .

following are my problems in implementing

1.Sending and receiving data streams using TIDUDPServer/client in INDY 10 (sample code in >indy 10) I am using delphi XE2
2.what is the maximum size of data one Packet in UDP can support
3.when i double click on IdUDPServer1.onUDPRead event the ide producing an error with

TArray <System.Byte>

I think the final error is because of newly introduced namespace in XE2.

what about using the following instead of indy

 Sockets.TTcpClient 
 Sockets.TTcpServer 
 Sockets.TUdpSocket 
Community
  • 1
  • 1
Vibeeshan Mahadeva
  • 7,147
  • 8
  • 52
  • 102
  • a) You shouldnt be using UDP for that. b) Study specifics about networking [there](http://stackoverflow.com/questions/1098897/what-is-the-largest-safe-udp-packet-size-on-the-internet) – Premature Optimization Oct 20 '11 at 10:59
  • I think the small piece(the area where movement is detected) in my image will be smaller than somewhere around 500 bytes,and I don't care if some some pieces are not updated. – Vibeeshan Mahadeva Oct 20 '11 at 11:10

1 Answers1

1
  1. Indy's UDP components do not support streams at all, only TIdBytes and String (which is internally handled using TIdBytes). If you want to send/receive TStream data, you have to copy the data to/from an intermediate TIdBytes.

  2. UDP is theoretically limited to ~64kb, but realistically much smaller by OS restrictions. You should generally not send more than 8-16kb per packet.

  3. That is a known Delphi compiler bug that has not been fixed yet in the past few releases. The IDE is generating code based on RTTI that the compiler does not consume correctly. That is not an Indy bug, but Embarcadero is aware of the issue. Until they (finally) fix the compiler bug, you can get around it by assigning the OnUDPRead event handler in code at runtime instead of at designtime.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770