我的公告
我的日历
 
2008年10月
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
 
我的相册
最新留言
最新评论
  • wjx
  • 写得不错,谢谢了
  • xiaoyuan
  • 刚刚试过,好用了,谢谢提供
  • lxian
  • 很好,谢谢
  • ccc
  • 具王暮 别人也只说你这里讲的最明白
  • 12
  • 12
  • angel
  • 谢谢
  • 游客
  • 頂 具王暮,這篇文章真的很不錯,謝謝
  • enjoylife0630
  • 这种方法试过了还是不行 啊 不知道何
  • 展翅高飞
  • 非常感谢
  • 小燕子
  • 你写得太好了!谢谢!
友情链接
文章专辑
空白面板
背景音乐
2007-07-21 14:28:30
//client端
using System;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace socketsample
{
 class Class1
 {
  static void Main()
  {
   try
   {
    int port = 2000;
    string host = "127.0.0.1";
    IPAddress ip = IPAddress.Parse(host);
    IPEndPoint ipe = new IPEndPoint(ip, port);//把ip和端口转化为IPEndPoint实例
    Socket c = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);//创建一个Socket
    Console.WriteLine("Conneting...");
    c.Connect(ipe);//连接到服务器
    string sendStr = "hello!This is a socket test";
    byte] bs = Encoding.ASCII.GetBytes(sendStr);
    Console.WriteLine("Send Message");
    c.Send(bs, bs.Length, 0);//发送测试信息
    string recvStr = "";
    byte] recvBytes = new byte1024];
    int bytes;
    bytes = c.Receive(recvBytes, recvBytes.Length, 0);//从服务器端接受返回信息
    recvStr
2007-07-02 08:06:09
System.Text.Encoding.GetEncoding("GB2312").GetString(byte())

2007-06-29 11:21:43
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Security.Cryptography;
namespace Cryptography
{
class Program
{
static void Main(string] args)
{
Program pro = new Program();
pro.StartDemo();
}
public void StartDemo()
{
// RSA的加解密过程:
// 有 rsa1 和 rsa2 两个RSA对象。
// 现在要 rsa2 发送一段信息给 rsa1, 则先由 rsa1 发送“公钥”给 rsa2
// rsa2 获取得公钥之后,用来加密要发送的数据内容。
// rsa1 获取加密了的数据内容后,用自己的私钥解密,得出原始的数据内容。
RSACryptoServiceProvider rsa1 = new RSACryptoServiceProvider();
RSACryptoServiceProvider rsa2 = new RSACryptoServiceProvider();
string publicKey;
publicKey = rsa1.ToXmlString(false);//导出 rsa1 的公钥
rsa2.FromXmlString(publicKey); //rsa2 导入 rsa1 的公钥,用于加密信息
string plainText;
plainText = "你好!这是用于加密解密的测试字符串";
Console.WriteLine("原始数据是:\n{0}\n", plainText);
byte] cipherBytes;
cipherBytes = rsa2.Encrypt(E
2007-06-28 21:57:02
<html>
<head>
<title>带阴影的时钟</title>
<style type="text/css">
<!--
.time{
font-family : Comic Sans Ms;
font-size : 18pt;
font-weight : bold;
color: #00008D;
}
-->
</style>
<script Language="JavaScript">
var ctimer;
function init(){
if (document.all){
tim2.style.left=tim1.style.posLeft;
tim2.style.top=tim1.style.posTop+tim1.offsetHeight-6;
settimes();
}
}
function settimes(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
if (hours<10)
hours="0"+hours;
if(mins<10)
mins="0"+mins;
if (secs<10)
secs="0"+secs;
tim1.innerHTML=hours+":"+mins+":"+secs
tim2.innerHTML=hours+":"+mins+":"+secs
ctimer=setTimeout('settimes()',960);
}
</script>
</head>
<body onLoad="init()">
<div
2007-06-28 21:09:25
setTimeout() 方法的返回值是一个唯一的数值,这个数值有什么用呢?如果你想要终止 setTimeout() 方法的执行,那就必须使用 clearTimeout() 方法来终止,而使用这个方法的时候,系统必须知道你到底要终止的是哪一个 setTimeout() 方法 (因为你可能同时调用了好几个 setTimeout() 方法),这样 clearTimeout() 方法就需要一个参数,这个参数就是 setTimeout() 方法的返回值 (数值),用这个数值来唯一确定结束哪一个 setTimeout() 方法。

2007-06-26 23:56:55
where tree.isterminal=1 and

2007-06-26 13:45:44
http://localhost/test/test.htm?id=1
<html>
<head>
</head>
<body>
<script languge=javascript>
alert(window.location.pathname); --返回 /test/test.htm
alert(window.location.search); --返回 ?id=1
alert(window.location.href); --返回 http://localhost/test/test.htm?id=1
</script>
</body>
</html>
location对象
含有当前URL的信息.
属性
href 整个URL字符串.
protocol 含有URL第一部分的字符串,如http:
host 包含有URL中主机名:端口号部分的字符串.如//www.cenpok.net/server/
hostname 包含URL中主机名的字符串.如http://www.cenpok.net ;
port 包含URL中可能存在的端口号字符串.
pathname URL中"/"以后的部分.如~list/index.htm
hash "#"号(CGI参数)之后的字符串.
search "?"号(CGI参数)之后的字符串.


2007-06-25 11:39:32
(1)、建立一个新的windows服务项目Server1
(2)、打开Service1代码视图,找到OnStart部分,加入代码
(3)、切换到设计视图,右键-添加安装程序
(4)、切换到新生成的ProjectInstaller.cs设计视图,找到serviceProcessInstaller1对Account属性设置为LocalSystem,对serviceInstaller1的ServiceName属性设置为Server1(服务的名字),StartType属性设置为Automatic(系统启动的时候自动启动服务)
(5)、建立一个新的安装项目ServerSetup(我们为刚才那个服务建立一个安装项目)
(6)、右键-添加-项目输出-主输出-选择Service1-确定
(7)、右键-视图-自定义操作-自定义操作上(安装)右键-添加自定义操作-打开应用程序文件夹-选择刚才那个主输出-确定
(7.5).右键-视图-自定义操作-自定义操作上(卸载)右键-添加自定义操作-打开应用程序文件夹-选择刚才那个主输出-确定 -设置(arguments属性='/u' 作为卸载时并卸载服务)
(8)、重新生成这个安装项目-右键-安装
(9)、在服务管理器中(我的电脑-右键-管理-服务和应用程序-服务)找到Server1服务,启动服务

2007-06-24 08:35:28
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace CallAnotherExe
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Process proc = new Process();
proc.StartInfo.FileName = @".\Mailer.exe";
proc.StartInfo.Arguments = "";
proc.Start();
}
}
}

2007-06-18 15:31:01
远程对象类:
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Channels.Http;

namespace Microsoft.Samples
{
public class HelloServer: MarshalByRefObject
{
private static int mCounter = 0;
public HelloServer()
{
Console.WriteLine("HelloServer activated");
}
public String HelloMethod(String name)
{
Console.WriteLine("Hello.HelloMethod : {0}", name);
return String.Format("Hi there {0}", name);
}
public int CountMe()
{
lock (this)
{
return mCounter++;
}
}
}
}

服务端:
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Channels.Http;

namespace Microsoft.Samples
{
publ
当前 1页/8页 首 页 下一页 末 页