Archived Forum Post

Index of archived forum posts

Question:

NETWORK IS UNREACHABLE

Aug 26 '15 at 00:43

Hi my project connects a client (Objective-C) to a server (C++), and it was working fine, but suddenly, i got "network is unreachable" Error. I've been struggling with this for a while, and i cant find a solution!!!

The code is as follows:

NSString *sslServerHost; sslServerHost = @"192.168.100.7"; int sslServerPort; sslServerPort = 8000;

//  Connect to the SSL server:
success = [socket Connect:sslServerHost
           port: [NSNumber numberWithInt: sslServerPort]
           ssl: ssl
           maxWaitMs:[NSNumber numberWithInt: maxWaitMillisec] ];

if (success != YES) {
    NSLog(@"%@",socket.LastErrorText);
    return;
}

//  Set maximum timeouts for reading an writing (in millisec)
socket.MaxReadIdleMs = [NSNumber numberWithInt:10000];
socket.MaxSendIdleMs = [NSNumber numberWithInt:10000];

//  Send a "Hello Server! -EOM-" message:
success = [socket SendString: @"Hello Server! -EOM-"];
if (success != YES) {
    NSLog(@"%@",socket.LastErrorText);
    return;
}

//  The server (in this example) is going to send a "Hello Client! -EOM-"
//  message.  Read it:
NSString *receivedMsg;
receivedMsg = [socket ReceiveUntilMatch: @"-EOM-"];
if (receivedMsg == nil ) {
    NSLog(@"%@",socket.LastErrorText);
    return;
}
 NSLog(@"%@",receivedMsg);

THIS IS THE ERROR I'M GETTING:

Connect_Socket: DllDate: Jan 22 2015 ChilkatVersion: 9.5.0.47 UnlockPrefix: RANIAASocket Architecture: Little Endian; 64-bit Language: IOS Objective-C VerboseLogging: 0 objectId: 1 Connect_Socket: hostname: 192.168.100.7 port: 8000 ssl: 1 maxWaitMs: 200000 socket2Connect: connect2: connectImplicitSsl: connectSocket: connect_ipv6_or_ipv4: socketErrno: 51 socketError: Network is unreachable --connect_ipv6_or_ipv4 --connectSocket --connectImplicitSsl ConnectFailReason: Connection rejected --connect2 --socket2Connect Failed. --Connect_Socket --Connect_Socket --ChilkatLog

Can someone please help me! I neeeeed help

Regards.