Thank you for the firewall suggestion, but I tried it and it didn't work, but the problem just got a little bit weirder and it may not be m0n0wall's fault. However I did end up fixing this whole deal (will explain in my huge post below), so no worries. And you might be able to explain the weird behavior I encountered while doing more testing getting it to work. Here is my story:
When m0n0wall is being used: The script sends the udp packet and it should get a reply from the same IP it just sent it to. However, taking a closer look at the firewall logs, no reply comes from the original IP I sent it to, but a reply DOES come back from a different IP (we'll called this
IP2 for simplification because I'll be mentioning it a few times) belonging to this same company, with the source port 29910. I know this is the reply I'm looking for because IP2 is almost exactly the same as the original IP, and the port it's using is 29910. However since IP2 is different than the original IP I connected to, that is why the script may not be picking up the reply it sends.. because the socket was opened for the original IP and not IP2.
So I tried adding rules to accept udp packets from IP2 so they wouldn't be blocked. Still no go,...the script wouldn't pick up the reply, but the packets are being flagged as allowed now as I told it to.
So I unplugged m0n0wall and directly connected to my cable modem and ran the script again. It worked fine now
. I fired up Wireshark to see what IP sent me the reply, and it was the original IP this time! And IP2, the one that sent the reply before when m0n0wall was in use... well it just didn't come in to play now. I didn't see it at all in Wireshark. No idea why it would send a reply from IP2 only when m0n0wall is being used, but not when it's just a direct connection to the cable modem.
I plugged m0n0wall back in, and adjusted the script to start the connection with IP2 instead, to see if it would work with the script. And it did, with m0n0wall in the middle too! And it still works to this second. So now I am initially connecting to IP2 and getting a reply from it, and the script works great with m0n0wall.
This is why I don't think it's m0n0wall's fault, because the server had to be the one deciding to have IP2 send a reply instead of the original IP. But I am still stumped as to why IP2 would send a reply when m0n0wall is in use, but not send anything when m0n0wall is NOT being used.
All in all, the script works great now that I am just working with just the "IP2" and I am satisfied. But the behavior of everything is just weird....unless I am not understanding something
.
Feel free to comment, I would love to have it explained. But if not, I will still be happy knowing that the script works once again. Thanks