Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7987545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:10:50+00:00 2026-06-04T12:10:50+00:00

I want to write (TCP) Server Client program. Client code should be in Objetive-C.

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:10:51+00:00Added an answer on June 4, 2026 at 12:10 pm

    I do the following, I hope it helps you:

    On the client (Objective C) I send the data as follows

    const uint8_t *str = (uint8_t *) [messageToSend cStringUsingEncoding:NSUTF8StringEncoding];
    

    On the C# Server I don’t use char[] I use byte[] and I read the data from the Socket then I convert them to string as follows (assume that the byte array is named data):

    string messageReceived = Encoding.UTF8.GetString(data, 0, bytesRead);
    

    bytesRead is an integer that holds the size of bytes read (I get it from the Stream since I use TCP Sockets).

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a client program that communicates with the application server via
I have two utilities written in C++, TCP/IP server and client that I have
I have existing chat server code written in C/C++ that communicates over TCP/IP with
I want to write an NSOutputStream to a server with apple's sample code: NSURL
I have written a TCP server implementation using which I created an application which
i'm trying to write simple C openssl client and server. Here is client's code:
I have the following code which should send a series values through TCP/IP, each
Well, i have a task to write Tcp Client for Andoid on java. Before,
I work on C#.recently i work on Tcp server-client .I write a client application
I want to create a C++ server/client that maximizes the throughput over TCP socket

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.