Esempio n. 1
0
void main(MemoryBus* bus1, MemoryBus* bus2)
{
    std::cout << "app2 started" << std::endl;

    Kernel k;
    PacketHandler ph;
    k.protocolHandler<uNet::DefaultProtocolHandler>()->setCustomHandler(&ph);

    MemoryBusInterface ifc12(&k, "IF12", bus1);
    ifc12.setNetworkAddress(NetworkAddress(0x0102, 0xFF00));
    k.addInterface(&ifc12);
    ifc12.start();

    MemoryBusInterface ifc21(&k, "IF21", bus2);
    ifc21.setNetworkAddress(NetworkAddress(0x0201, 0xFF00));
    k.addInterface(&ifc21);
    ifc21.start();
    std::this_thread::sleep_for(std::chrono::milliseconds(250));

    test_server(k);

    std::this_thread::sleep_for(std::chrono::seconds(1));
    ifc12.stop();
    ifc21.stop();
}
Esempio n. 2
0
void main(MemoryBus* bus2)
{
    std::cout << "app3 started" << std::endl;

    Kernel k;

    MemoryBusInterface ifc22(&k, "IF22", bus2);
    ifc22.setNetworkAddress(NetworkAddress(0x0202, 0xFF00));
    k.addInterface(&ifc22);
    ifc22.start();
    std::this_thread::sleep_for(std::chrono::milliseconds(250));

    test_server(k);

    std::this_thread::sleep_for(std::chrono::seconds(1));
    ifc22.stop();
}
Esempio n. 3
0
void main(MemoryBus* bus1)
{
    std::cout << "app1 started" << std::endl;

    Kernel k;
    MemoryBusInterface ifc11(&k, "IF11", bus1);
    ifc11.setNetworkAddress(NetworkAddress(0x0101, 0xFF00));
    k.addInterface(&ifc11);
    ifc11.start();
    std::this_thread::sleep_for(std::chrono::milliseconds(250));

    k.addStaticRoute(uNet::NetworkAddress(0x0200, 0xFF00),
                     uNet::HostAddress(0x0102));

    test_client(k);

    std::this_thread::sleep_for(std::chrono::seconds(1));
    ifc11.stop();
}