]> Dogcows Code - chaz/yoink/blobdiff - src/Main.cc
win32 port of new sockets, with fixes
[chaz/yoink] / src / Main.cc
index 277cc3dde45eaa7642c79cc1d61b3a4aa196f252..c6df957010d16fc2cd65dfc6a43fdc1e4ca68752 100644 (file)
@@ -280,7 +280,7 @@ void goodbye()
 
 int main(int argc, char* argv[])
 {
-       Mf::ResolverTask task("compy", "4950", SOCK_DGRAM);
+       Mf::ResolverTask task("4950", "255.255.255.255", SOCK_DGRAM);
        task.run();
 
        int i = task.wait();
@@ -295,21 +295,27 @@ 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;
+
+       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 << (int64_t)-1234567890123456789;
+       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<char> hi;
+       std::vector<short> hi;
        hi.push_back(34);
        hi.push_back(-12345);
        hi.push_back(7734);
@@ -329,10 +335,25 @@ int main(int argc, char* argv[])
        Mf::logInfo << "packet size: " << packet.size() << std::endl;
 
 
+       Mf::SocketAddress addr("634", "lappy");
+       Mf::logInfo << "local addr: " << addr.name() << std::endl;
+
        for (it = task.addresses().begin(); it != task.addresses().end(); ++it)
        {
+               int bcast = 0;
+
                Mf::SocketAddress addr = *it;
                Mf::Socket sock(addr);
+
+               sock.get(SO_BROADCAST, bcast);
+               Mf::logInfo << "bcast: " << bcast << std::endl;
+
+               sock.set(SO_REUSEADDR, 1);
+               sock.set(SO_BROADCAST, 1);
+
+               sock.get(SO_BROADCAST, bcast);
+               Mf::logInfo << "bcast: " << bcast << std::endl;
+
                sock.write(packet);
        }
 
This page took 0.021702 seconds and 4 git commands to generate.