关于网络编程

MrYoucheng 2003-05-03 03:55:32
谁给些关于网络编程的例子
...全文
24 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
seaman117 2003-09-14
  • 打赏
  • 举报
回复
还有我
seaman117@21cn.com
aiguoke 2003-05-08
  • 打赏
  • 举报
回复
加我一个guoke69@hotmail.com
MrYoucheng 2003-05-08
  • 打赏
  • 举报
回复
上面有啊
polly.com@163.net
MessiahLS 2003-05-07
  • 打赏
  • 举报
回复
缺少了两个文件
#include "socketstream.h"
#include "multistream.h"
能不能给我?Messiah_ls@163.com
erliuzi 2003-05-07
  • 打赏
  • 举报
回复
glasswing(蜻蜓飞飞)
可以给我发一个吗? 小弟我也正在学这个 ,先谢 了 ,
erliuzi0805@21cn.com
glasswing 2003-05-07
  • 打赏
  • 举报
回复
已经发了,记得reply我哦

老大我不知道你email啊
MrYoucheng 2003-05-07
  • 打赏
  • 举报
回复
我也要:)
dillonxie 2003-05-07
  • 打赏
  • 举报
回复
glasswing(蜻蜓飞飞)
如果方便的话也请发一份给小弟摸索学习一下吧!谢谢!

dillonxie@1010.com
angowb 2003-05-07
  • 打赏
  • 举报
回复
To: glasswing(蜻蜓飞飞)
那就谢谢大哥了!
我的mail: angowb@163.com
glasswing 2003-05-07
  • 打赏
  • 举报
回复
自己写的两个小文件,如果你要可以发给你。都还只是一个原型,请多指教。
angowb 2003-05-07
  • 打赏
  • 举报
回复
To glasswing(蜻蜓飞飞):
请问下面的文件在哪里阿?谢谢!
#include "socketstream.h"
#include "multistream.h"
glasswing 2003-05-07
  • 打赏
  • 举报
回复
给你贴一个用smtp协议发email的例子,有兴趣的继续讨论:

#include <string>
#include <iostream>
#include <sstream>
#include "socketstream.h"
#include "multistream.h"

int main(int argc, char *argv[])
{
char *smtp_server = (argc==1) ? "smtp.163.net:25" : argv[1] ;

std::string to, from;
std::cout << "To: " ;
std::cin >> to ;
std::cout << "From: ";
std::cin >> from;
std::string tmp;
std::getline(std::cin, tmp);

std::string subject;
std::cout << "Subject: ";
std::getline(std::cin, subject);

std::string text;
std::cout << std::endl;
std::ostringstream oss;
oss << std::cin.rdbuf();

my::tcpstream tts(smtp_server);
if ( !tts )
{
std::cerr << "smtp server open failure\n" ;
}
my::multistream ts(tts);
ts.add(std::cout);
try
{
std::string line;

std::getline(ts, line);
if ( line.compare(0,3,"220") )
{
throw int(1);
}

ts << "HELO " << "faderose.hack.net" << std::endl ;
std::getline(ts, line);
if ( line.compare(0,3,"250") )
{
throw int(1);
}

ts << "MAIL FROM: " << from << std::endl ;
std::getline(ts, line);
if ( line.compare(0,3,"250") )
{
throw int(1);
}

ts << "RCPT TO: " << to << std::endl ;
std::getline(ts, line);
if ( line.compare(0,3,"250") )
{
throw int(1);
}

ts << "DATA" << std::endl ;
std::getline(ts, line);
if ( line.compare(0,3,"354") )
{
throw int(1);
}

ts << "From: " << from << std::endl;
ts << "To: " << to << std::endl;
ts << "Subject: " << subject << std::endl;
ts << std::endl;
ts << oss.str();

ts << "\r\n.\r\n";

std::getline(ts, line);
if ( line.compare(0,3,"250") )
{
throw int(1);
}

ts << "QUIT" << std::endl;
std::cout << "send success\n";
}
catch ( ... )
{
ts << "QUIT" << std::endl;
std::cerr << "send failure\n" ;
}
}
MrYoucheng 2003-05-04
  • 打赏
  • 举报
回复
还有个问题
tc可以写这样的程序吗
MrYoucheng 2003-05-04
  • 打赏
  • 举报
回复
polly.com@163.net
如果有文档的话也一起给我吧
分全给你
manonroad 2003-05-03
  • 打赏
  • 举报
回复
我有作业的例子要不要,虽然简单一些,但是体现socket编程基本思路,可以帮助你理解socket编程。 需要的话,留下email,多给点分。hehe.
ghtsao 2003-05-03
  • 打赏
  • 举报
回复
到MSDN里去看socket的文档,有例子。

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧