#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0

    Problem with Tidudpclient in Delphi XE4


    I wanted to create an application that communicates with an electronic board thru UDP, I have sniffed the communication through Wireshark and decoded the protocole that it uses and copied out the data sniffed to my delphi program that it sends to the board using an instance of Tidudpclient that comes with Indy.
    While the application works perfectly fine with delphi 6, in Delphi XE4 it sends a modified version of the data I wanted to send for some reason that I ignore.
    1st approach, tried to use Tudpsocket, but, got a problem for receiving data as the buffer stays always empty.
    2nd approach, I decided to create a the actual application with Delphi XE4 and a dll that makes the UDP Communication using delphi 6. and then got into quite a trouble with the pointer problem.

    I am stuck at the moment and do not know what to do. I simply want to send a broadcast through UDP and get it the answer back if any and it has to somehow have an interface with delphi XE4.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by he1p
    I wanted to create an application that communicates with an electronic board thru UDP, I have sniffed the communication through Wireshark and decoded the protocole that it uses and copied out the data sniffed to my delphi program that it sends to the board using an instance of Tidudpclient that comes with Indy.
    While the application works perfectly fine with delphi 6, in Delphi XE4 it sends a modified version of the data I wanted to send for some reason that I ignore.
    1st approach, tried to use Tudpsocket, but, got a problem for receiving data as the buffer stays always empty.
    2nd approach, I decided to create a the actual application with Delphi XE4 and a dll that makes the UDP Communication using delphi 6. and then got into quite a trouble with the pointer problem.

    I am stuck at the moment and do not know what to do. I simply want to send a broadcast through UDP and get it the answer back if any and it has to somehow have an interface with delphi XE4.
    Tried also to rollback to indy8 in Delphi XE4 that comes with Delphi 6 but then again I didn't know how to make em compatible
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    156
    Rep Power
    3
    I think you had fallen to unicode trap. I believe you had sent the data through string data type. In XE4, character size in a string were of 2 bytes, while in Delphi 6 it's only 1 byte. If my suspicion is correct, your XE4 sends out data twice as much as it used to be, and half of that were garbage.

    Use AnsiString instead of string.

IMN logo majestic logo threadwatch logo seochat tools logo