c#(Socket)异步套接字代码示例

2019-12-26 11:15:51于海丽

// Size of receive buffer. 
public const int BufferSize = 256; 
// Receive buffer. 
public byte[] buffer = new byte[BufferSize]; 
// Received data string. 
public StringBuilder sb = new StringBuilder(); 

public class AsynchronousClient { 
// The port number for the remote device. 
private const int port = 11000; 
// ManualResetEvent instances signal completion. 
private static ManualResetEvent connectDone = 
new ManualResetEvent(false); 
private static ManualResetEvent sendDone =