refactored the IP address handling code
It is now split up much more cleanly, has less stuff running on the
cRIO, and doesn't do as much of the stuff with string manipulation.
Before, it was kind of ridicilous how many times the code converted IP
addresses back and forth between 32-bit ints and strings to do various
manipulations and pass them around. Also, there was various junk that
the cRIO code did that it did not need to be doing.
diff --git a/aos/common/network/SendSocket.h b/aos/common/network/SendSocket.h
index fca904a..9323da8 100644
--- a/aos/common/network/SendSocket.h
+++ b/aos/common/network/SendSocket.h
@@ -3,6 +3,10 @@
#include "Socket.h"
+#include "aos/atom_code/configuration.h"
+#include "aos/common/network_port.h"
+#include "aos/common/util.h"
+
namespace aos {
class SendSocket : public Socket {
@@ -10,8 +14,10 @@
// Connect must be called before use.
SendSocket() {}
// Calls Connect automatically.
- SendSocket(NetworkPort port, const char *robot_ip) {
- Connect(port, robot_ip);
+ SendSocket(NetworkPort port, ::aos::NetworkAddress address) {
+ Connect(port,
+ ::aos::util::MakeIPAddress(::aos::configuration::GetOwnIPAddress(),
+ address));
}
int Connect(NetworkPort port, const char *robot_ip, int type = SOCK_DGRAM);
};