I want to write (TCP) Server Client program.
Client code should be in Objetive-C. Server side code should be in C#.
I have written some code. It is working. But the issue is; I am sending the message from Client to Server. Server is receiving the message. But the received message is looking like “Encrypted” data.
code:
Objective-C
const uint8_t *rawdata = (const uint8_t*)[@"Welcome..." UTF8String];
[outputStream write:rawdata maxLength:strlen((const char *)rawdata)];
C#
char[] chara = new char[data.Length / sizeof(char)];
System.Buffer.BlockCopy(data, 0, chara, 0, chara.Length);
String content = new String(chara);
Console.WriteLine("Received data : " + content);
Please help me to fix the issue.
I do the following, I hope it helps you:
On the client (Objective C) I send the data as follows
On the C# Server I don’t use
char[]I usebyte[]and I read the data from the Socket then I convert them tostringas follows (assume that thebytearray is nameddata):bytesReadis an integer that holds the size of bytes read (I get it from the Stream since I use TCP Sockets).I hope this helps.