C#的TCP通信
TCP是连接模型,如下:
服务器连接 服务器断开
↓ ↑
服务器接收→服务器处理→服务器发送
↑ ↓
客户端发送←客户端处理←客户端接收
↑ ↓
客户端连接 客户端断开
服务器代码如下:
//
ServerListen
TcpListener tcplistener
=
new
TcpListener(
int
.Parse(txtPort.Text));
tcplistener.Start();
byte
[] btServerReceive
=
new
byte
[
256
];
string
strServerReceive
=
string
.Empty;
//
Loop for Listen
while
(
true
)
{
TcpClient tcp
=
tcplistener.AcceptTcpClient();
NetworkStream ns
=
tcp.GetStream();
int
intReceiveLength
=
ns.Read(btServerReceive,
0
,btServerReceive.Length);
strServerReceive
=
UnicodeEncoding.Unicode.GetString(btServerReceive,
0
,intReceiveLength);
txtServerResult.AppendText(
"
ServerReceive:
"
+
strServerReceive
+
"
"
);
ns.Write(btServerReceive,
0
,btServerReceive.Length);
txtServerResult.AppendText(
"
ServerSend:
"
&
相关文档:
创建一个Winform用户控件 UserControl1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
namespace MyActiveT ......
private void MakeLegend(IActiveView activeView,IPageLayout pageLayout)
{
//定义图例UID对象
UID uid = new UIDClass();
&n ......
http://www.tangiblesoftwaresolutions.com/Product_Details/Instant_CSharp.html
http://www.tangiblesoftwaresolutions.com/?gclid=COeGzKKxo58CFQIupAodu2jvJQ
在线
VB.net和C#在线互转工具
http://bbs.51aspx.com/showtopic-2059.html
Convert VB.NET to C#
http://www.developerfusion.com/tools/convert/vb-to- ......
C#实现Windows Form的透明背景用下面这段代码能实现非常有意思真正的透明背景,透明的地方不仅能显示其下一层的图案,而且能让鼠标穿越过去,成为真正的透明化。
注释掉的3行中,前2行代码是实现透明效果的另外第一个办法,最后1行是第三种办法。
但第一个方法根本不起作用,因为Windows Form所用“调色板”是&l ......
private void save_db(){
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings[""].ToString());
SqlCommand comm = new SqlCommand();
conn.Open();
SqlTransaction rollbk2= conn.BeginTransaction();
& ......