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

The Archive Base Latest Questions

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

i had made the following programming for client server programming but it is not

  • 0

i had made the following programming for client server programming but it is not working. the server is not able to receive the request for connection setup.plz help.

#import "clientserverprogramViewController.h"
#import "secondview.h"
#import <CoreFoundation/CFSocket.h>
#include <sys/socket.h>
#include <netinet/in.h>

NSInputStream *iStream;
NSOutputStream *oStream; 

@implementation clientserverprogramViewController

@synthesize  name,filepath,display;

-(IBAction) print {
    NSString *urlStr = serverIP;]
    [display setText : urlStr];

    if (![urlStr isEqualToString:@""]) {
        NSURL *website = [NSURL URLWithString:urlStr];

        if (!website) {
            NSLog(@"%@ is not a valid URL");
            return;
        }
        NSHost *host = [NSHost hostWithName:[website host]];

        [NSStream getStreamsToHost:host port:3000 inputStream:&iStream  outputStream:&oStream];

        [iStream retain];
        [oStream retain];

        [iStream setDelegate:self];
        [oStream setDelegate:self];
        [iStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
                           forMode:NSDefaultRunLoopMode];

        [oStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
                           forMode:NSDefaultRunLoopMode];

        [iStream open];
        [oStream open];
    }
}

-(IBAction) settings {
    [self presentModalViewController:nextview animated: YES];
}


-(IBAction) cancel {
    exit(0);
}

- (void)dealloc {
    [super dealloc];
}

@end
  • 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-23T02:38:43+00:00Added an answer on May 23, 2026 at 2:38 am

    Is there a specific reason you’re using streams?

    What about using NSURLConnection? Here’s a piece of code from a project of mine. Both are in KANetworkManager. KANetworkTransactionType is simply a enum that helps me know how to parse the response.

    + (void) createAndStartUrlConnection:(NSMutableURLRequest *)request type:(KANetworkTransactionType)type target:(id)target callback:(SEL)callback;
    {
        [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
        NSDictionary *requestDict = [NSDictionary dictionaryWithObjectsAndKeys:request, @"request", [NSNumber numberWithInt:type], @"type", target, @"target", [NSValue valueWithPointer:callback], @"callback", nil];
    
        [KANetworkManager performSelectorInBackground:@selector(makeNetworkCall:) withObject:requestDict];
    }
    

    I’m able to made a synchronous network call because I always call this method on its own thread. It’s a simpler way to achieve asynchronous network communications without dealing with delegates (although the delegate method provides some benefits). Your parseResponse method would need to be specific to whatever your web service it sending back. parseResponse would notify the callback method. Let me know if you have additional questions regarding this.

    + (void) makeNetworkCall:(NSDictionary *)params
    {
        // We assume this method won't be called from the main thread, so we need our own NSAutoreleasePool.
        NSAutoreleasePool *autoreleasePool = [[NSAutoreleasePool alloc] init];
    
        NSMutableURLRequest *request = [params objectForKey:@"request"];
        KANetworkTransactionType type = [(NSNumber *)[params objectForKey:@"type"] intValue];
        id target = [params objectForKey:@"target"];
        SEL callback = (SEL)[[params objectForKey:@"callback"] pointerValue];
    
        NSURLResponse *response;
        NSError *err;
        // We make a synchronous request assuming we're on a background thread.
        NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
        if (data.length > 0)
        {        
            [self parseResponse:data type:type target:target callback:callback];
        }
        else
        {
            NSLog(@"Error occured during network call. %@", err);
        }
    
        [autoreleasePool drain];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had made some questions regarding PHP-GTK (there are only 4 php-gtk tagged questions
I once had a MySQL database table containing 25 million records, which made even
Some of the answers to a question I had about redirect_to made me think
I had used Server Explorer and related tools for graphical database development with Microsoft
I had a discussion with some colleagues mentioning that there are not too many
In PHP web programming, I always made a singleton Output object in which I
So I made the following test for a class Board that would to be
I had some problems figuring out a good title, but hopefully the code examples
I think I understand the error message: CoreData could not fulfill a fault, but
Had an interesting discussion with some colleagues about the best scheduling strategies for realtime

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.