摘要:
下面举个简单的例子来说明怎么使用这个基类。下面这个server实现的功能很简单,通过实现基类的docommunication抽象方法来实现监听8000端口,如果有客户端连接,就发送一条信息。为了说明stop的用法,我另起了一个线程在30秒后自动关闭这个server.你可以把程序编译后运行,然后通过ie来访问看一下实现的功能。
testserver.cs
using syste......
摘要:
http.cs
----------------------------
using system;
using system.collections;
using system.io;
using system.net;
using system.net.sockets;
using system.threading;
class httpprocessor {......
记得原来有人问过用socket实现smtp,这是我的一部分代码
namespace mysmtp
{
using system;
using system.net;
using system.net.sockets;
using system.text;
using system.collections;
interface itransport
{
void sethost(string smtphost);
string gethost();
void setport(int smtpport);
int getport();
void sendmail(mailmessage msg);
}
public class smtp : itransport
{
private string smtphost;
private int smtpport;
public smtp()
{
//smtphost = "127.0.0.1";
//smtpport = 25;
}
public smtp(string host, int port)
{
smtphost = host;
smtpport = port;
}
public void sethost(string host)
{
smtphost = host;
}
public string gethost()
{
return smtphost;
}
...
下一页 摘要:
i use winsock control sp5(vb6)
public class frmmain
inherits system.windows.forms.form
#region " windows 窗体设计器生成的代码 "
public sub new()
mybase.new()
该调用是 windows 窗体设计器所必需的。
i......