Swift TCP client check connection ipv4

579 Views Asked by At

If the Wifi connection is active and I'm on the network 192.168.1.xxx and try to establish the connection:

var readStream: Unmanaged<CFReadStream>?
    var writeStream: Unmanaged<CFWriteStream>?
    ///77.246.237.150

    CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault,
                                       "192.168.2.100" as CFString,
                                       5555,
                                       &readStream,
                                       &writeStream)
    inputStream = readStream!.takeRetainedValue()
    outputStream = writeStream!.takeRetainedValue()

The delay is 2 minutes before I know the status of the connection. Check for nil readStream writeStream inputStream outputStream does not help Help please solve this problem Use Simple Ping is not suitable since ping can not be done ping to a specific port. Since this port has a TCP server up

0

There are 0 best solutions below