简单的telnet示例在LIBCURL - C ++ [英] Simple telnet example in LIBCURL - C++

查看:650
本文介绍了简单的telnet示例在LIBCURL - C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要简单的TELNET示例在LIBCURL(curl.haxx.se/libcurl)(C ++)
我在这个网站上搜索,但我没有找到任何简单的例子。
我只需连接到TELNET,验证和发送消息。

I need to fing simple TELNET example in LIBCURL (curl.haxx.se/libcurl) (C++) I searched over this site, but I don't found any simple example. I need only to connect to TELNET, authenticate, and send message.

感谢

推荐答案

libcurl中所有你可以做的是发送数据和接收数据。没有办法等待响应或基于响应发送数据。 libcurl的整体点是处理等待HTTP或FTP的数据和响应。

All you can do in libcurl is send data and recieve data. There is no way to wait for response or send data based on response. The whole point of libcurl is to handle waiting for data and responses for HTTP or FTP.

也就是说,你可以使用 CURLOPT_READFUNCTION CURL_READFUNC_PAUSE 。从 READFUNCTION 返回 PAUSE ,然后调用 curl_easy_pause(CURLPAUSE_CONT)当您在 READFUNCTION 中看到login:时。准备好在 READFUNCTION 时返回您的用户名。

That being said, you may be able to do something with CURLOPT_READFUNCTION and CURL_READFUNC_PAUSE. Return PAUSE from READFUNCTION, then call curl_easy_pause(CURLPAUSE_CONT) when you see "login:" in your READFUNCTION. Be prepared to return your user name from READFUNCTION when it gets called.

我从来没有这样做过,我不能证明它是如何工作的。但从API描述,这似乎是走的路... ...

I've never done this, so I can't vouch for how it works. But from API description, this seems to be the way to go...

这篇关于简单的telnet示例在LIBCURL - C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆