3

I cannot see any UDP-related network activity via Wireshark when executing the following code (hardcoded/shortened for simplicity). Using Swift 4, running simulation on iOS 11 iPad Pro.

let addr = "192.168.0.18"
let port: Int32 = 1900
let fullAddr = Socket.createAddress(for: addr, on: port)

try socket = Socket.create(family: .inet, type: .datagram, proto: .udp)

try socket?.write(from: "Hello!", to: fullAddr!)

The goal is to send MSEARCH for device discovery. I was successful in sending datagrams using SwiftSocket with the same information, and even got a reply from the device I'm attempting to communicate with (Sony A7RII). I verified this with Wireshark. Unfortunately I had to switch to BlueSocket because it is much more complete. Now I can't see any network activity.

I feel like I'm missing something obvious, but cannot see what it is.

First time Swift developer, also a networking beginner. And first SO question. Wow!

  • Hi Andrew, welcome to stack-overflow! In Wireshark, have you tried looking under different interfaces for your missing packets? What about setting up a minimal command line project and testing whether your code snippet works without the bloat of the simulator? Using your code I have had success both in the simulator and command line (using SwiftPM). – Mrwerdo Dec 02 '17 at 11:39
  • Thank you! I was listening on the wrong device. Oops. You just saved me so much time and frustration! – Andrew English Dec 02 '17 at 16:29

0 Answers0