title: Socketswift connection timeout to specific ip address
body: <p>I had the idea to connect my wifi wall adapter to my computer. I first watched for other ideas and found that link:<a href="http://www.ludwich.de/ludwich/smart_home_IdOTy.html" rel="nofollow noreferrer">Connecting through pc</a>
  In this link is a python code, which I also tried and worked perfectly for me. Than I tried to rebuild it in Swift and found Socketswift. I implemented it and tried to connect to "192.168.2.131" with port 8530, it didn't worked. I'm getting the failure: "connection timeout". Until now I could not figure out what I am doing wrong because when I try the same thing through python it works.
  Here is my python code:</p>
  
  <pre><code>d = socket.socket()
  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM,0)
  s.connect(('192.168.2.131', 8530)) # (IP, Port) is a single variable passed to connect function
  s.send(bytearray.fromhex('01 40' + mac + on)) # to switch 'on'
  time.sleep(5) # sleep for 5 seconds
  </code></pre>
  
  <p>And here my IOS/Swift code:</p>
  
  <pre><code>let client = TCPClient(address: "192.168.2.131", port: 8530)
  
          switch client.connect(timeout: 10){
          case .success:
              print("connected")
              var hex: String = String("01 40" + mac + off)
              var byteArray = [UInt8]()
              byteArray += hex.utf8
              let data: Data = Data(bytes: byteArray)
              let result = client.send(data: data)
          case .failure(let error):
              print(error)
          }
  </code></pre>
  
  <p>Thank you for your answers. I you have any questions or need more information please send me a message</p>