在應用程序Example_
http://develop
圖
頁面MySocket
private void Page_Load(object sender
{
if(!Page
{
//發送數據
SocketSend();
}
}
private void SocketSend()
{
//創建發送數據的Socket
Socket sendsocket = new Socket(AddressFamily
SocketType
//設置發送數據的地址
IPEndPoint endPoint = new IPEndPoint(IPAddress
//創建讀取文件的流
FileStream fileSteam = new FileStream(Server
FileMode
//文件大小
Byte[] fsSize = new Byte[fileSteam
//讀取文件的二進制流
BinaryReader reader = new BinaryReader(fileSteam);
//讀取數據
reader
//鏈接目的地
sendsocket
//發送數據
sendsocket
//關閉文件流
right
From:http://tw.wingwit.com/Article/program/net/201311/15235.html