1

I'm trying to send a UDP packet with CocoaAsyncSocket. I've implemented the socket instance creation and the send method as follows:

let IP = "192.168.2.255"
let PORT:UInt16 = 6454
var socket:GCDAsyncUdpSocket!

func sendPacket(){
    socket = GCDAsyncUdpSocket(delegate: self, delegateQueue: dispatch_get_main_queue())
    let message = "test"
    let data = message.dataUsingEncoding(NSUTF8StringEncoding)
    socket.sendData(data, toHost: IP, port: PORT, withTimeout: 2, tag: 0)
}

I'm testing it with an iPad connected on my local Wi-Fi network. On a computer connected on the same network, I've installed Wireshark and I'm listening to the UDP packets received. No packet corresponding to mine is received.

Any idea why? :/

Jojo56400
  • 309
  • 3
  • 12

0 Answers0