由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 请教一个用matlab tcpip函数的问题
相关主题
C中的精度问题A C++ exception question
大家帮我看看C文件输入函数fprintf的问题node.js, express, sails, angularjs在一起做project,折磨人啊
关于fscanf格式化读取的问题.【请教】fscanf 和 fstream 哪一个更好? (转载)
Perl and Matlab Questionc里从文件读数据,什么方法比较好?
C的fscanf的问题我也问个UDP网络编程中遇到的问题
fprintf in C\C++C语言中关于fseek和fscanf/fgets的怪事。
[合集] Why it only write the file once?is smart_ptr really that good?
发现自己写buffer还是能加速fwrite的问个matlab socket问题
相关话题的讨论汇总
话题: fprintf话题: user话题: fscanf话题: xxx话题: tcpip
进入Programming版参与讨论
1 (共1页)
c******d
发帖数: 906
1
请教一下如果使用instrument toolbox
目的是使用matlab去登陆 本地邮件服务器
t=tcpip('localhost',110);
fopen(t);
fscanf(t) % 这里返回 +OK POP3
fprintf(t,'USER xxx') % 到这里就不行了,不能输入任何字符
fscanf(t)
% 返回 "A timeout occurred before the Terminator was reached. "
fprintf(t,'PASS xxx');
fscanf(t)
% 同样返回 "A timeout occurred before the Terminator was reached. "
fclose(t);
delete(t);
clear t;
j*a
发帖数: 14423
2
try
fprintf(t,'USER xxx\n')
fprintf(t,'USER xxx\n\r')
fprintf(t,'USER xxx\r\n')
etc

【在 c******d 的大作中提到】
: 请教一下如果使用instrument toolbox
: 目的是使用matlab去登陆 本地邮件服务器
: t=tcpip('localhost',110);
: fopen(t);
: fscanf(t) % 这里返回 +OK POP3
: fprintf(t,'USER xxx') % 到这里就不行了,不能输入任何字符
: fscanf(t)
: % 返回 "A timeout occurred before the Terminator was reached. "
: fprintf(t,'PASS xxx');
: fscanf(t)

c******d
发帖数: 906
3
试过,还是不行。。。

try
fprintf(t,'USER xxx\n')
fprintf(t,'USER xxx\n\r')
fprintf(t,'USER xxx\r\n')
etc

【在 j*a 的大作中提到】
: try
: fprintf(t,'USER xxx\n')
: fprintf(t,'USER xxx\n\r')
: fprintf(t,'USER xxx\r\n')
: etc

j*a
发帖数: 14423
4
再加个fflush(t)

【在 c******d 的大作中提到】
: 试过,还是不行。。。
:
: try
: fprintf(t,'USER xxx\n')
: fprintf(t,'USER xxx\n\r')
: fprintf(t,'USER xxx\r\n')
: etc

c******d
发帖数: 906
5
自问自答一下
需要设置telnet的Terminator字符
'CR/LF' for both read and write
没有设置的时候,matlab默认是'LF' for both read/write
这样在telnet环境下,系统不知道什么时候算终止。。。

【在 c******d 的大作中提到】
: 请教一下如果使用instrument toolbox
: 目的是使用matlab去登陆 本地邮件服务器
: t=tcpip('localhost',110);
: fopen(t);
: fscanf(t) % 这里返回 +OK POP3
: fprintf(t,'USER xxx') % 到这里就不行了,不能输入任何字符
: fscanf(t)
: % 返回 "A timeout occurred before the Terminator was reached. "
: fprintf(t,'PASS xxx');
: fscanf(t)

1 (共1页)
进入Programming版参与讨论
相关主题
问个matlab socket问题C的fscanf的问题
主力程序员离职后怎么办?fprintf in C\C++
贴一下我的 12306 实现吧[合集] Why it only write the file once?
请教大牛们这个系统怎么设计发现自己写buffer还是能加速fwrite的
C中的精度问题A C++ exception question
大家帮我看看C文件输入函数fprintf的问题node.js, express, sails, angularjs在一起做project,折磨人啊
关于fscanf格式化读取的问题.【请教】fscanf 和 fstream 哪一个更好? (转载)
Perl and Matlab Questionc里从文件读数据,什么方法比较好?
相关话题的讨论汇总
话题: fprintf话题: user话题: fscanf话题: xxx话题: tcpip