fileSteam
//關閉發送數據的Socket
sendsocket
sendsocket
}
單擊頁面MySocket
private void ReceiveBtn_Click(object sender
{
//接收數據
SendReceiveData();
}
private void SendReceiveData()
{
//創建接收數據的Socket
Socket receiveSocket = new Socket(AddressFamily
SocketType
//設置接收數據的地址
IPEndPoint hostPoint = new IPEndPoint(IPAddress
//設置端口
receiveSocket
//監聽
receiveSocket
//設置接收數據緩沖區的大小
Byte[] recData = new Byte[
Socket hostSocket = receiveSocket
//接收數據
hostSocket
if(hostSocket
{
//顯示接收數據的信息
LabelData
+
}
//創建一個新文件保存接收的數據
right
From:http://tw.wingwit.com/Article/program/net/201311/15234.html