Best way to get my app to react to an incoming pdu?

Hi guys,

I'm making a desktop sms sending app out of an smpp library (https://github.com/onlinecity/cpp-smpp), the sending works perfectly, but I want to be able to receive delivery reports, which will involve leaving the connection open and waiting for a report pdu to be received.

Thing is I have very little experience dealing with sockets, and no experience dealing with threads, and am not sure what the best way of receiving this psu would be. I was thinking of setting up a separate thread that just constantly reads from the port, but it seems likely there would be some way of setting a listener or something that would just trigger a function when the pdu comes in. Is that doable?

This is how the smpp connection is made:

1
2
3
boost::asio::io_service smpp_io_service;
tcp::endpoint endpoint(ip::address_v4::from_string("192.168.0.25"), 2775);
std::shared_ptr<tcp::socket> smpp_socket(new tcp::socket(smpp_io_service));


What technique would be best here?

Thanks!
Last edited on
Registered users can post here. Sign in or register to post.