use futures::{SinkExt, StreamExt};
use rusmpp::{Command, CommandId, CommandStatus, Pdu, tokio_codec::CommandCodec};
use tokio::net::TcpStream;
use tokio_util::codec::Framed;
#[tokio::main]
async fn main() -> Result<(), Box<dyn core::error::Error>> {
let stream = TcpStream::connect("127.0.0.1:2775").await?;
let mut framed = Framed::new(stream, CommandCodec::new());
let command = Command::new(CommandStatus::EsmeRok, 1, Pdu::EnquireLink);
framed.send(command).await?;
while let Some(Ok(command)) = framed.next().await {
if let CommandId::EnquireLinkResp = command.id() {
break;
}
}
Ok(())
}