当前位置:首页 » 编程软件 » 和码编程视频

和码编程视频

发布时间: 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

网络云网盘链接如上,需要自行保存。

热点内容
qml文件修改后编译未生效 发布:2025-05-14 07:31:00 浏览:329
内到内算法 发布:2025-05-14 07:29:11 浏览:33
文件夹名字不显示 发布:2025-05-14 07:27:47 浏览:774
oracle的数据库驱动jar 发布:2025-05-14 07:23:20 浏览:555
我的世界电脑版服务器手机版能进吗 发布:2025-05-14 07:22:01 浏览:678
达内培训php多少钱 发布:2025-05-14 07:19:10 浏览:26
python字节转字符串 发布:2025-05-14 07:06:35 浏览:421
subplotpython 发布:2025-05-14 06:53:51 浏览:661
竖屏大屏导航工厂密码一般是多少 发布:2025-05-14 06:49:29 浏览:806
如何在手机里设置无线网密码 发布:2025-05-14 06:47:54 浏览:120