摘要: 实现多客户端向服务器发送数据using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;using System.Net;using System.Net.Sockets;namespace MyAsyncServer{ class Program { private static byte[] byteData = new byte[1024]; static void Main(stri... 阅读全文
posted @ 2013-02-12 00:28 louiskoo 阅读(855) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;using System.Net;using System.Net.Sockets;namespace MyAsyncServer{ class Program { private static byte[] byteData = new byte[1024]; static void Main(string[] args) ... 阅读全文
posted @ 2013-02-12 00:04 louiskoo 阅读(3392) 评论(0) 推荐(0) 编辑
摘要: serverSocket.BeginAccept( new AsyncCallback(AcceptedCallback), serverSocket); client.BeginConnect( ipEnd, new AsyncCallback(ConnectedCallback), client);会连接不上,加上public static ManualResetEvent connEvent = new ManualRe... 阅读全文
posted @ 2013-02-11 23:40 louiskoo 阅读(1659) 评论(0) 推荐(0) 编辑
摘要: HttpContext.Current.Server.MapPath("~/") 阅读全文
posted @ 2013-02-11 21:22 louiskoo 阅读(525) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/peterzb/archive/2009/05/29/1491605.html 阅读全文
posted @ 2013-02-10 22:17 louiskoo 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2013-02-10 21:09 louiskoo 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 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 ... 阅读全文
posted @ 2013-02-10 21:08 louiskoo 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2013-02-10 21:02 louiskoo 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 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;... 阅读全文
posted @ 2013-02-10 21:01 louiskoo 阅读(254) 评论(0) 推荐(0) 编辑
摘要: AsyncServer: Bind - Listen - BeginAccept - EndAccept - BeginReceive - EndReceive - BeginSend - EndSend - Shutdown - CloseAcceptCallbackReadCallbackSendCallbackAsyncClient: BeginConnect - EndConnect -BeginSend - EndSend - BeginReceive - EndReceive- Shutdown - Close ConnectCallbackSendCallback Receive 阅读全文
posted @ 2013-02-10 20:57 louiskoo 阅读(225) 评论(0) 推荐(0) 编辑