July 24th, 2013, 10:26 AM
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.
July 24th, 2013, 10:28 AM
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
Originally Posted by he1p
July 25th, 2013, 12:27 AM
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.