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 6190109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:31:43+00:00 2026-05-24T02:31:43+00:00

From my PC app I am sending socket data to my iPhone. When the

  • 0

From my PC app I am sending socket data to my iPhone. When the data arrives it is being stored as a signed value instead of unsigned (uint8). So I can’t get any values in above 127.

When I send a 0xFF it defaults back to 0x3f.

Is CFReadStreamRead only meant for ASCII characters? If so what would be a replacement?

My code:

CFReadStreamRef readStream = NULL;
CFWriteStreamRef writeStream = NULL;
CFIndex bytes;
UInt8 buffer[128];
UInt8 recv_len = 0;
UInt8 send_len = 0;

//
//Get the native socket that was used
CFSocketNativeHandle sock = *(CFSocketNativeHandle*)data;


//
//Create the read and write streams for this socket
CFStreamCreatePairWithSocket(kCFAllocatorDefault, sock, &readStream, &writeStream);

//
//Check for errors
if (!readStream || !writeStream)
{
    close(sock);
    fprintf(stderr, "CFStreamCreatePairWithSocket failed.");
    return;
}

//
//Open the streams
CFReadStreamOpen(readStream);
CFWriteStreamOpen(writeStream);

//
//Read the command bytes
short command = 0;

memset(buffer, 0, sizeof(buffer));
bytes = CFReadStreamRead(readStream, buffer, 12);
  • 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-05-24T02:31:44+00:00Added an answer on May 24, 2026 at 2:31 am

    0x3f is ASCII '?'. Are you trying to decode the byte buffer as a UTF-8 string? If so, there’s your problem. The CFReadStream API is unlikely to be messing with the data; it’s much more likely that you are.

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

Sidebar

Related Questions

I've been getting these errors intermittently from sending email from my django app. I
Here's the line from App.Config: <add key=CheckFileFormatString value=P{0}\t&quot;{1}, {2}&quot;\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}/> Here's the code that puts
Possible Duplicate: Make iPhone app paid version replace free version on install from app
I have a web-app-database 3 tier server setup. Web requests data from app, and
How can I get runnig path of my application from app.xaml.cs itself?
I am running a iframe tab app. After sending invites from my app, I
Only certain users can no longer receive notifications from my app. I was able
I'm trying to send data from my Android app to my PC over TCP.
I am having trouble sending email from my app at Google App Engine. I
I am using Google SMTP for sending out emails from my app. The mails

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.