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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:42:03+00:00 2026-05-23T09:42:03+00:00

I have a connection between iPod client and C server. I can send the

  • 0

I have a connection between iPod client and C server.
I can send the data of the slider as I move the slider, and get the data on the server correctly. Only problem is the blue point of the slider doesn’t move, nor does the label under it change the slider’s value. When I disconnect, the blue point moves to the point it should be and the label shows its value. Here are the codes:

-(void)stream:(NSStream *)theStream handleEvent:(NSStreamEvent)streamEvent
{
  switch (streamEvent)
  {         
    case NSStreamEventHasSpaceAvailable:
        event = @"NSStreamEventHasSpaceAvailable";
        connectButton.enabled = NO;
        disconnectButton.enabled = YES;

        if (theStream == oStream)
        {
         //send data
             const uint8_t *buffer = (const uint8_t *)[dataSlider UTF8String];  
             NSInteger err = [self writeToServer:buffer];                 
             if ( err == -1)
                NSLog(@"Error sending data."); 
             else   
                NSLog(@"Success sending data.");
        }
        break;
}

- (IBAction)sliderChanged:(id)sender 
{ 
   UISlider *slider = (UISlider *)sender; 
   progressAsInt = (int)(slider.value + 0.5f); 
   sliderValue = [[NSString alloc] initWithFormat:@"%d", progressAsInt]; 
   sliderLabel.text = sliderValue; 
   dataSlider = sliderValue;
}

This is the way it should work: the server is always asking for something to printf. I move the slider and send its value, whenever the server calls read().

Problem: the slider doesn’t visually move, but its value changes (i can see it in the server’s printfs).

Any thoughts?

  • 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-23T09:42:04+00:00Added an answer on May 23, 2026 at 9:42 am

    Seems that the constant “knowing that the stream had space available” was clogging the program and UI. I changed the flow of the program to wait for a message from the sever and only after that it would send the data. Here it is:

    case NSStreamEventHasBytesAvailable:
            event = @"NSStreamEventHasBytesAvailable";
            if (theStream == iStream)
             {           
                //read data
                uint8_t buffer[1024];
                int len;
                while ([iStream hasBytesAvailable])
                {
                    len = [iStream read:buffer maxLength:sizeof(buffer)];
                    if (len > 0)
                    {
                        NSString *output = [[NSString alloc] initWithBytes:buffer length:len encoding:NSASCIIStringEncoding];
                        if (nil != output)
                        {                 
                            //Now that the server gave its signal to move on, send data to server
    
                            NSString *data = [[torqueValue stringByAppendingString:@" "] stringByAppendingString:angleValue];
                            const uint8_t *buffer2 = (const uint8_t *)[data UTF8String];  
                            NSInteger err = [self writeToServer:buffer2];
    
                            if ( err == -1)
                                NSLog(@"Erro a enviar os dados."); 
                            else   
                                NSLog(@"Transmitiu com sucesso.");
    
                        }
                    }
                }    
             }
            break;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a connection between a client and a server using ssh. What
I have a problem with a really slow connection between my Java code and
I have a problem with my Java program. It has a socket connection between
I have a connection to a Microsoft SQL Server and want the change the
so i am building a client server application and i have to chose how
I have an applet that I want to maintain a socket connection between multiple
I have an application where I want to simulate the connection between a device
I have an app in android which is a kind of client-server. I've established
What is the best way to have synchronized a collection of objects between various
I have a connection string being passed to a function, and I need to

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.