X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMain.cc;h=051b22c5a4998e71a5ecb61468227f4fafbe3cec;hp=277cc3dde45eaa7642c79cc1d61b3a4aa196f252;hb=c78934a448d0126709fccec3d5a636b3baa87da4;hpb=41f8dd670e963aad94527ce2be0486268993a477 diff --git a/src/Main.cc b/src/Main.cc index 277cc3d..051b22c 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -280,7 +280,7 @@ void goodbye() int main(int argc, char* argv[]) { - Mf::ResolverTask task("compy", "4950", SOCK_DGRAM); + Mf::ResolverTask task("4950", "compy", SOCK_DGRAM); task.run(); int i = task.wait(); @@ -295,46 +295,42 @@ int main(int argc, char* argv[]) << " (" << addr.type() << ")" << std::endl; } - Mf::SocketAddress addr("www.apple.com", "80", SOCK_DGRAM); - - Mf::logInfo << "address: " << addr.name() << ":" << addr.port() - << " (" << addr.type() << ")" << std::endl; - - Mf::Packet packet(1000000); - packet << (uint16_t)45; - Mf::logInfo << "packet size: " << packet.size() << std::endl; - packet << (int64_t)-1234567890123456789; - 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; + 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; - packet << false << false << false << true << false; - Mf::logInfo << "packet size: " << packet.size() << std::endl; + //for (it = task.addresses().begin(); it != task.addresses().end(); ++it) + //{ + int bcast = 0; - - for (it = task.addresses().begin(); it != task.addresses().end(); ++it) - { - Mf::SocketAddress addr = *it; + //Mf::SocketAddress addr = *it; Mf::Socket sock(addr); - sock.write(packet); - } + sock.connect(); + + sock.get(SO_BROADCAST, bcast); + Mf::logInfo << "bcast: " << bcast << std::endl; + + sock.set(SO_BROADCAST, 1); + + sock.get(SO_BROADCAST, bcast); + Mf::logInfo << "bcast: " << bcast << std::endl; + + Mf::logInfo << "sending packet of size: " << packet.size() << std::endl; + //sock.write(packet); + sock.write(&bcast, sizeof(bcast)); + //} return 0;