Browse DevX
Sign up for e-mail newsletters from DevX


Extend Your Instant Messenger Application with FTP Support and Private Chat : Page 5

In part 1 of this article, you learned to create a mult-user chat application using network programming in .NET. In this article, you'll build on that application to add sophisticated features such as file downloads.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Testing the Application
In the interest of simplicity I have assumed that data sent over the TCP stream are sent and received in the same block. However, this is not always true. Data sent over the TCP stream are not guaranteed to arrive at once; you may receive a portion of the message in the current read cycle and receive the rest in the next read cycle, or several messages may be read at the same time.

In this case, you need to modify your application so that you are able to differentiate the different messages sent by the user.

To test the application, first run the server by pressing F5 in Visual Studio 2005. You want to launch multiple copies of the client to test the multi-user capabilities of the server. To do this, compile the code files provided with this article into an .exe file. Run multiple copies of Winclient.exe and sign in and chat at the same time.

In this article, I have shown how you can define your own protocols to build a robust chat application. It's a fun application that will also help you learn to do some sophisticated tasks using network programming in .NET.

Wei-Meng Lee is a Microsoft MVP and founder of Developer Learning Solutions, a technology company specializing in hands-on training on the latest Microsoft technologies. He is an established developer and trainer specializing in .NET and wireless technologies. Wei-Meng speaks regularly at international conferences and has authored and coauthored numerous books on .NET, XML, and wireless technologies. He writes extensively on topics ranging from .NET to Mac OS X. He is also the author of the .NET Compact Framework Pocket Guide, ASP.NET 2.0: A Developer's Notebook (both from O'Reilly Media, Inc.), and Programming Sudoku (Apress). Here is Wei-Meng's blog.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date