摘要:
http://www.cnblogs.com/peterzb/archive/2009/05/29/1491605.html 阅读全文
摘要:
using System;using System.Net;using System.Net.Sockets;using System.Text;public class SynchronousSocketClient { public static void StartClient() { // Data buffer for incoming data. byte[] bytes = new byte[1024]; // Connect to a remote device. try { // Establ... 阅读全文
摘要:
using System;using System.Net;using System.Net.Sockets;using System.Text;public class SynchronousSocketListener { // Incoming data from the client. public static string data = null; public static void StartListening() { // Data buffer for incoming data. byte[] bytes = new ... 阅读全文
摘要:
using System;using System.Net;using System.Net.Sockets;using System.Text;using System.Threading;// State object for reading client data asynchronouslypublic class StateObject{ // Client socket. public Socket workSocket = null; // Size of receive buffer. public const int BufferSize = 102... 阅读全文
摘要:
using System;using System.Net;using System.Net.Sockets;using System.Threading;using System.Text;// State object for receiving data from remote device.public class StateObject{ // Client socket. public Socket workSocket = null; // Size of receive buffer. public const int BufferSize = 256;... 阅读全文
摘要:
AsyncServer: Bind - Listen - BeginAccept - EndAccept - BeginReceive - EndReceive - BeginSend - EndSend - Shutdown - CloseAcceptCallbackReadCallbackSendCallbackAsyncClient: BeginConnect - EndConnect -BeginSend - EndSend - BeginReceive - EndReceive- Shutdown - Close ConnectCallbackSendCallback Receive 阅读全文
摘要:
BackgroundWorker connectWork = new BackgroundWorker(); public FormClient(){ connectWork.DoWork += new DoWorkEventHandler(connectWork_DoWork); connectWork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(connectWork_RunWorkerCompleted);} /// <summary> /// 异步方式与服务器进行连接 ... 阅读全文
摘要:
执行顺序不一样 private static int newTask(int mms) { //C } private delegate int NewTaskDelegate(int mms); static void Main(string[] args) { //A NewTaskDelegate newTst = newTask; IAsyncResult asyncResult = newT... 阅读全文
摘要:
NetworkStream networkStream = client.GetStream(); BinaryReader br = new BinaryReader(networkStream); BinaryWriter bw = new BinaryWriter(networkStream); 阅读全文
摘要:
PerformClick生成按钮的Click事件。 阅读全文