摘要:
除了点对点,通常UDP数据的传递方式有两种,一种是BroadCast,一种是MultiCast。中文一般把它们翻译作广播和组播。前者是简单的在局域网里面广播;后者是借助路由器将数据发送到包括英特网在内的任何多个地址。在C#里面,处理UDP通讯最简单的方法就是使用UdpClient。具体使用方法我也不赘述了,在msdn上就有。需要注意的问题有:1、UDP通讯在发送的时候可以绑定任何本地端口,但是在接收的时候需要在本地绑定广播或者多播端口。2、组播的时候发送和接收双方都需要JoinMulticastGroup。参数timeToLive名字很容易让人误会,其实它指的是允许UDP数据穿过几个路由器(当 阅读全文
posted @ 2011-09-03 21:05
94cool
阅读(1079)
评论(0)
推荐(0)
摘要:
服务器端:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Net;usingSystem.Net.Sockets;namespaceUDPServer{classProgram{staticvoidMain(string[]args){intrecv;byte[]data=newbyte[1024] 阅读全文
posted @ 2011-09-03 21:04
94cool
阅读(633)
评论(0)
推荐(0)
摘要:
private void createdir() { string uri = "ftp://127.0.0.1/test/; if (!Directory.Exists(uri)) { FtpWebRequest frequest = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri)); frequest.Credentials = new NetworkCredential(user, pwd); frequest.Method = WebRequestMethods.Ftp.MakeDirectory; try { FtpWebR 阅读全文
posted @ 2011-09-03 00:11
94cool
阅读(1976)
评论(1)
推荐(0)
浙公网安备 33010602011771号