I am trying to write a TFTP server. I have successfully completed the code, it is fully RFC 1350 compliant.
However, I wrote the whole thing in Haiku OS, and in Haiku, it works great. However, I also need a DHCP server, and I don't have one for Haiku. So I need to port my TFTP server to Linux.
Now the code compiles fine in linux, but does not receive any packets sent to it. I can do wireshark captures and see that the packets are arriving, but my server does not receive them. I added some debugging printfs and found that bind is returning a -1 (instead of 0 like in Haiku). I am running the executable as root, so its not a permissions issue. Am I doing something wrong? Here is some of my code:
Since your port is <1024, are you running as root?
Some more error checking wouldn't go amiss either. You might have found the error to be "EPERM" or something.
I am running the executable as root, so its not a permissions issue.
Yes, I am running as root. sudo ./tftps
I'm thinking maybe something else is using that port, but I uninstalled all other tftp severs, and I see no other traffic on wireshark.
Meanwhile, i'll add some more error checking. I have a tendency to use printf for all debugging.