當前位置:首頁 » 編程軟體 » 和碼編程視頻

和碼編程視頻

發布時間: 2023-07-12 23:35:38

『壹』 求C#網路編程視頻教程!!!!

何需視頻?
1.簡單伺服器端
/*
using System.Data;
using System.Net.Sockets;
using System.Net;
using System.Threading;
*/
private static int port = %%2;
private static Thread thThreadRead;
private static TcpListener TcpListen;
private static bool bListener = true;
private static Socket stRead;
private static void Listen()
{
try
{
TcpListen = new TcpListener(port);
TcpListen.Start();
stRead = TcpListen.AcceptSocket();
EndPoint tempRemoteEP = stRead.RemoteEndPoint;
IPEndPoint tempRemoteIP = (IPEndPoint)tempRemoteEP;
IPHostEntry host = Dns.GetHostByAddress(tempRemoteIP.Address);
string sHostName = host.HostName;
while (bListener)
{
stRead.Send(Encoding.ASCII.GetBytes("Hello"));
string sTime = DateTime.Now.ToShortTimeString();
Byte[] byRead = new Byte[1024];
int iRead = stRead.ReceiveFrom(byRead, ref tempRemoteEP);
Byte[] byText = new Byte[iRead];
Array.Copy(byRead, 0, byText, 0, iRead);
string line = System.Text.Encoding.Default.GetString(byRead);
}
}
catch (System.Security.SecurityException)
{
//監聽失敗
}
}
thThreadRead = new Thread(new ThreadStart(Listen));
thThreadRead.Start();

2.簡單客戶端
/*
using System.Data;
using System.Net.Sockets;
using System.Net;
*/
private static IPEndPoint dateTimeHost;
string hostIPString=%%1;
string hostPortString=%%2;
IPAddress hostIP=IPAddress.Parse(hostIPString);
dateTimeHost=new IPEndPoint(hostIP,Int32.Parse(hostPortString));
Socket conn=new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
conn.Connect(dateTimeHost);
int bytes=0;
Byte[] RecvBytes=new Byte[256];
bytes=conn.Receive(RecvBytes,RecvBytes.Length,0);
string RecvString=Encoding.ASCII.GetString(RecvBytes,0,bytes);
Console.WriteLine(RecvString);
conn.Shutdown(SocketShutdown.Both);
conn.Close();

3.獲得本機IP
//using System.Net;
IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;
string %%1=null;
for (int i = 0; i < addressList.Length; i++)
{
%%1 += addressList[i].ToString();
}

4.端對端通信
/*
using System.Net;
using System.Net.Sockets;
*/
UdpClient client=new UdpClient(%%2);
IPAddress a=IPAddress.Parse("127001");
IPEndPoint receivePoint=new IPEndPoint(a,%%2);
IPAddress HostIP=null;
byte[] sendData=Encoding.UTF8.GetBytes(%%3);
byte[] recData;
try{
HostIP=IPAddress.Parse(%%1);
}
catch {
recData=client.Receive(ref receivePoint);
%%3=Encoding.UTF8.GetString(recData);
client.Send(sendData,sendData.Length,%%4,%%2);
client.Close();
}
IPEndPoint host=new IPEndPoint(HostIP,%%2);
recData=client.Receive(ref receivePoint);
%%3=Encoding.UTF8.GetString(recData);
client.Close();

5.點對點通信
/*
using System.Data;
using System.Net.Sockets;
using System.Net;
using System.Threading;
*/
Thread th;
TcpListener tpListen1;
bool listenerRun=true;
NetworkStream tcpStream;
StreamWriter reqStreamW;
TcpClient tcpc;
Socket skSocket;
protected void Listen()
{
try{
tpListen1=new TcpListener(Int32.Parse(%%2));
tpListen1.Start();
skSocket=tpListen1.AcceptSocket();
EndPoint tempRemoteEP=skSocket.RemoteEndPoint;
IPEndPoint tempRemoteIP=(IPEndPoint)tempRemoteEP;
IPHostEntry host=Dns.GetHostByAddress(tempRemoteIP.Address);
string HostName=host.HostName;
while(listenerRun)
{
Byte[] stream=new Byte[1024];
string time=DateTime.Now.ToString();
int i=skSocket.ReceiveFrom(stream,ref tempRemoteEP);
string %%5=Encoding.UTF8.GetString(stream);
//指定編碼,從緩沖區中解析出內容
//time+" "+HostName+":"
}
}
catch(Security.SecurityException)
{
//防火牆安全錯誤!
}
try{
string sMsg=%%4;
string MyName=Dns.GetHostName();
reqStreamW=new StreamWriter(tcpStream);
reqStreamW.Write(sMsg);
reqStreamW.Flush();
string time=DateTime.Now.ToString();
//顯示傳送的數據和時間
//time+" "+MyName+":"
//sMsg
}
catch(Exception)
{
//無法發送信息到目標計算機!
}

protected override void Dispose(bool disposing)
{
try{
listenerRun=false;
th.Abort();
th=null;
tpListen1.Stop();
skSocket.Close();
tcpc.Close();
}
catch{}
if(disposing && component!=null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}

『貳』 可以發下博雅小學堂Scratch入門編程課視頻(20講)的百度資源非常感謝

鏈接:

提取碼: bn3r

博雅小學堂Scratch入門編程課視頻, 20講完結版網路網盤高清視頻。隨著電子計算機技術的不斷普及和應用,讓孩子們從小就掌握一門計算機語言已經是很多家長和老師的選擇,博雅小學堂Scratch入門編程課緊跟這一教學要求,以面向未來的人工智慧技術為前提,帶領孩子們緊跟時代潮流,從多個知識點面鋪展開來,塑造孩子成為能夠從容面對未來的新型人才。

『叄』 c語言程序設計視頻教程

鏈接:

提取碼: gfdg

C語言程序設計:

『肆』 求plc編程入門基礎知識教學plc編程入門視頻教程全集百度雲網盤下載

你好,很高興回答你的問題,我用網路網盤分享給你1080P的

鏈接:

提取碼:9hcb

網路雲網盤鏈接如上,需要自行保存。

熱點內容
寒靈之劍腳本 發布:2025-02-07 06:57:12 瀏覽:118
解壓的窗口 發布:2025-02-07 06:44:34 瀏覽:797
android身份證 發布:2025-02-07 06:36:43 瀏覽:430
python的庫在哪 發布:2025-02-07 06:30:24 瀏覽:348
帶鎖的鉛筆如何改密碼 發布:2025-02-07 06:18:05 瀏覽:164
ubuntu搭建samba伺服器 發布:2025-02-07 05:52:54 瀏覽:54
小型企業網如何配置可以互通 發布:2025-02-07 05:33:56 瀏覽:243
09年crv哪個配置好 發布:2025-02-07 05:17:31 瀏覽:555
nvm源碼編譯 發布:2025-02-07 05:13:19 瀏覽:126
防偽碼查詢源碼 發布:2025-02-07 05:09:39 瀏覽:770