This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Tuesday, November 11, 2008

how to implement multithreaded TCP/UDP client/server in Csharp

The Server: The simple multi-threaded TCP/UDP Server v1 provides a TCP and UDP servers running at separate threads. The sockets can receive a text messages send frm the client machine, and return a confirmation together with the received text back to the client. It uses the traditional socket programming methods (socket/bind/listen/accept). In the v2 of this program, I will make use if the .Net library's TcpListener? that will make things much easier.

The Client: The simple TCP/UDP Client v2 allows users to send a simple text message to the server and get a confirm message from the server. Users can either use TCP or UDP to send this message. The program uses the traditional socket programming technique (socket/bind/connect/send). In v2 of this program, I will make use of .Net library's TcpClient? and UdpClient?, that will make things much easier.

To demo the program, the user has to run the server and the client on separate machines. It he/she wants to run both server and client on the same machine, the server's host name has to be the machine's host name. That is, it can't be "localhost". If "localhost" is used, there will be a socket exception. I still can't figure out why yet.

All the other required information is provided at the beginning of each file.

This post intends to be a beginner level of server/client socket programming and multi-threading demo.


CLICKHER TO DOWNLOAD SOURCE CODE

0 comments:

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Blog Archive

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger