开发者

Need help with C# Server/Client style program

I've always wanted to learn TCP or UDP(I hear UDP sucks though) in C# but I can never find ANY tutorial that can teach 开发者_高级运维it. I mean, I've googled tutorials to the point where the results aren't even relevant anymore. Almost every tutorial I've come across explains TCP as if I already knew it, or they introduce terms but never explain them. After a few months, I have made absolutely NO progress. Any help here?

Note: I am not a beginner programmer, I have experience making programs. It's just the TCP tutorials out there suck.


You're possibly searching with the wrong keywords. The keyword is sockets. The TCP/IP programming API is called sockets, on pretty much all platforms including .NET.


try codeproject.com

They have a lot of tutorials with pretty good code samples about TCP/UDP communication (among other things).

One of the many


I think it's difficult to find tutorials for TCP and UDP specifically because they are specific protocols (although very frequently used) and Microsoft are trying to abstract all these concepts so that your application is not dependent of the underlying technology.

Nowadays, you'll be advised to use Windows Communication Foundation (WCF); and you have a lot of resources from MSDN or the beginner's guide.

By the way, learning TCP cannot be done with a tutorial, but with a book focused on networking such as this one. If you do so, you'll also learn why UDP doesn't "suck"...


The reason there is no Cä# toutorial is because it is not needed. You basically ask "is there a course telling me how the rules are on streets when I drive a mercedes". Hint: there are the rules how to drive n streets, and theree is a manual for a mercedes car.

Or: There are books about the IP protocol, and then there is the .NET documentation how .NET implements this. If you ever want to be more than a junior in the field of programming then better get used to learn abstract concepts separate and do not expect a full "howto" for every simple step.

Now, TCP / UDP are fully separate items. They both extend TCP and they have very different uses. Saying "udp sucks" would be quite ignorant towards a lot of programs I know that would never work with TCP and require the fast and easy data distribution of UDP (which, cont´rary to TCP, also supports multicast). Most of my traffic counting in gb) external these days is UDP based because udp does not get stuck on a lost packet, and list packets can be easily requieried with a specialized higher level (application level) protocol. TCP has the really nasty habit of getting stuck up to 3 minutes when a packet is lost. Sometimes (like: financial data, voip) this is not really acceptable. Most programs love the easy handling of TCP, but it comes with a significant price.


UDP is a different beast.

however, I found this very useful as a starting point: TCP/IP tutorial


I've written some .NET-based TCP/IP posts on my blog.

They're not a tutorial; rather, they are a few articles on common mistakes. I'd recommend reading them after you understand the tutorials. I also list a couple of good TCP/IP books under the resources section.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜