Should TcpClient be used for this scenario?
- by Martín Marconcini
I have to communicate with an iPhone. I have its IP Address and the port (obtained via Bonjour).
I need to send a header that is “0x50544833” (or similar, It’s an HEX number), then the size of the data (below) and then the data itself.
The data is just a string that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist SYSTEM "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>clientName</key>
<string>XXX</string>
<key>clientService</key>
<string>0be397e7-21f4-4d3c-89d0-cdf179a7e14d</string>
<key>registerCode</key>
<string>0000</string>
</dict>
</plist>
The requirement also says that I must send the data in little endian format (which I think is the default for Intel anyway).
So it would be: hex_number + size of data + string_with_the_above_xml.
I need to send that to the iPhone and read the response.
What would be, according to your experience, the best way to send this data (and read the response)?