gunterhager / UDPBroadcastConnection

Framework to send UDP broadcast messages and listen to responses using a Dispatch source.
MIT License
84 stars 28 forks source link

Unicast UDP connection - Question #7

Closed kordskontrol closed 6 years ago

kordskontrol commented 6 years ago

Hello, I am using UDPBroadcastConnection successfully from an IOS client, to send a message to a local server running in Java. The server receives perfectly well the message, get the client IP address thanks to it, and send back an answer to the client. The handler of the client receives the answer, and identify the IP address of the server thanks to it. No issue. Once UDPBroadcastConnection has received the answer, will it continue to send broadcast messages, or will it send messages only to the server that answered? How could I simply modify the code to send only UDP messages to the server IP address, when the "discovery" routin is done? I am really a beginner concerning swift and UDP sockets, I barely understand 10% of the UDPBroadcastConnection code, so I would appreciate some help :) Thanks!

gunterhager commented 6 years ago

Sorry for the long delay, I was pretty busy preparing an app launch.

UDPBroadcastConnection will just send one broadcast message and wait for an answer. Then it's done. You'll need to call sendBroadcast() again if you want to broadcast again.

To send to the server that answered you'd need to use you own code - in my app I used the regular http protocol to communicate with my server. I use the UDP broadcast only to discover my server on the LAN.

kordskontrol commented 6 years ago

Hello, Thanks for the answer!! Regards

Le mer. 4 juil. 2018 à 14:25, Gunter Hager notifications@github.com a écrit :

Sorry for the long delay, I was pretty busy preparing an app launch.

UDPBroadcastConnection will just send one broadcast message and wait for an answer. Then it's done. You'll need to call sendBroadcast() again if you want to broadcast again.

To send to the server that answered you'd need to use you own code - in my app I used the regular http protocol to communicate with my server. I use the UDP broadcast only to discover my server on the LAN.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gunterhager/UDPBroadcastConnection/issues/7#issuecomment-402463735, or mute the thread https://github.com/notifications/unsubscribe-auth/AmqNzuzQqRPdjTDt_rn49xlafJvyXTrwks5uDLQxgaJpZM4U1GFM .