X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMain.cc;h=051b22c5a4998e71a5ecb61468227f4fafbe3cec;hp=4d88a709e69bb39a71e739a574823e254ff2f0ac;hb=351a86a5275f355b55f3827175a72853995f2aaa;hpb=e434d5eee9eaf196a5f4bb8c6118b6be3b84a421 diff --git a/src/Main.cc b/src/Main.cc index 4d88a70..051b22c 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -296,46 +296,19 @@ int main(int argc, char* argv[]) } - Mf::Packet packet(1000000); - - packet << 5.1234f; - Mf::logInfo << "packet size: " << packet.size() << std::endl; - - float meh3; - packet >> meh3; - Mf::logInfo << "float: " << meh3 << std::endl; - Mf::logInfo << "packet size: " << packet.size() << std::endl; - - - packet << uint16_t(45); - Mf::logInfo << "packet size: " << packet.size() << std::endl; - packet << uint64_t(1234567812345679ULL); - Mf::logInfo << "packet size: " << packet.size() << std::endl; - - packet << true << false << false << true << false << true << true; - Mf::logInfo << "packet size: " << packet.size() << std::endl; - - std::vector hi; - hi.push_back(34); - hi.push_back(-12345); - hi.push_back(7734); - - for (int a = 0; a < 15900; a++) + std::vector hi; + for (int a = 0; a < 4000; a++) { hi.push_back(a); } + Mf::logInfo << "array size: " << hi.size() << std::endl; + Mf::Packet packet; packet << hi; - Mf::logInfo << "packet size: " << packet.size() << std::endl; - - packet << "hello world"; - Mf::logInfo << "packet size: " << packet.size() << std::endl; - - packet << false << false << false << true << false; - Mf::logInfo << "packet size: " << packet.size() << std::endl; - - Mf::SocketAddress addr = Mf::SocketAddress::broadcast("4950"); + Mf::SocketAddress addr("4950", "155.98.111.159", SOCK_DGRAM); + //Mf::SocketAddress addr = Mf::SocketAddress::broadcast("4950"); + //Mf::SocketAddress addr("4950", "155.98.109.255", SOCK_DGRAM); //Mf::logInfo << "local addr: " << addr.name() << std::endl; //for (it = task.addresses().begin(); it != task.addresses().end(); ++it) @@ -344,6 +317,7 @@ int main(int argc, char* argv[]) //Mf::SocketAddress addr = *it; Mf::Socket sock(addr); + sock.connect(); sock.get(SO_BROADCAST, bcast); Mf::logInfo << "bcast: " << bcast << std::endl; @@ -353,7 +327,9 @@ int main(int argc, char* argv[]) sock.get(SO_BROADCAST, bcast); Mf::logInfo << "bcast: " << bcast << std::endl; - sock.write(packet); + Mf::logInfo << "sending packet of size: " << packet.size() << std::endl; + //sock.write(packet); + sock.write(&bcast, sizeof(bcast)); //}