3

I have written one client application , which uses the mdnsreponder for some service discovery . I have one requirement that my client IP will get change very frequently. whenever there is a change in the IP I need to do the discovery again . So I have written simple test application which will change the IP for every 1 min and do the discovery .

Everything works fine but after few IP changes(some 7-10 times changed) it gives below socket error .

(below is the error code of sendto socket function in the mdnsresponder code)

mdnsplatformsend udp got error 22 .

After that my request will not put it on the interface with new IP.

Again I have to restart my application, then only it works...

Can somebody help to figure out the problem, why does it stop after a few trials?

alk
  • 69,737
  • 10
  • 105
  • 255
indra
  • 832
  • 4
  • 17
  • 33
  • 2
    errno==22 is EINVAL (invalid argument). You are passing an incorrect parameter to the sendto function. You don't show if your socket is binding to INADDR_ANY(0) or a specific adapter - as that could be at stake. Please show us your code. – selbie Dec 11 '13 at 07:42
  • As you do not show us how you call ` sendto()` inlcuding the definition and the initialisation of the parameters passed, we can only guess. My 1st guess is you pass an invalid socket descriptor. – alk Dec 15 '13 at 15:32

1 Answers1

3

Please re check the parameters of sendto function that you are passing. This error can be occurred when the socket binding is lost. That means the address where the socket is bound has changed or invalid. The error can also be caused because of wrong size of the address structure that you are passing.

Naseef Chowdhury
  • 2,357
  • 3
  • 28
  • 52