We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example.c file's cpp version would be very apriciated. Thank you.
The text was updated successfully, but these errors were encountered:
This is what i have so far. On vs 2019 its working without any problem.
// Udp Server #define ZNPP_STATIC_API #include "znet.hpp" #include <iostream> using namespace zsummer::network; ZSummerEnvironment g_appEnvironment; int main(void) { EventLoopPtr lp = std::make_shared<EventLoop>(); if (lp->initialize()) { UdpSocket rec; if (rec.initialize(lp, "127.0.0.1", 12345)) { char rmsg[256]; rec.doRecvFrom(rmsg, 256, [&rmsg](NetErrorCode err, char const* ip, unsigned short port, unsigned count) { if (err == NEC_SUCCESS) { rmsg[count] = '\0'; std::cout << ip << ":" << port << " " << rmsg << std::endl; } } ); lp->runOnce(); } else { return -2; } } else { -1; } return 0; }
// Udp client #define ZNPP_STATIC_API #include "znet.hpp" #include <iostream> using namespace zsummer::network; ZSummerEnvironment g_appEnvironment; int main(void) { EventLoopPtr lp = std::make_shared<EventLoop>(); if (lp->initialize()) { // Client. UdpSocket uscok; if (uscok.initialize(lp, "127.0.0.1", 0)) { std::string msg = "Hello world !"; uscok.doSendTo(msg.data(), msg.size(), "127.0.0.1", 12345); } else { return -1; } } return 0; }
Sorry, something went wrong.
I didn't like the code style you had used, I thought there were better options at least.
starwing
No branches or pull requests
example.c file's cpp version would be very apriciated. Thank you.
The text was updated successfully, but these errors were encountered: