Lost Password?

  #1 (permalink)  
Old 11-07-2006, 08:35 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,135
Rep Power: 16
Lop is on a distinguished road
Default Code: Managed C++ .NET 2.0: Instant Messanger Server

This is the code for a Visual Studio Managed C++ .net Instant Messanger Server. I say server because it was meant to receive the messages.

The code below is how it receives messages via a loop

Code:
	private: void RunIMServer() {
				 while (!stopped) {
					 TcpClient^ client = imListener->AcceptTcpClient();
					 String^ data;
					 
					 // See if the client is connected
					 while (client->Connected) {
					 //if (client->Connected) {
						 NetworkStream^ stream = client->GetStream();

						 // Create our byte array for reading
						 array<unsigned char,1>^ bytes = gcnew array<unsigned char>(256);

						 // Loop to receive all the data sent by the client.
						while (int i = stream->Read(bytes, 0, bytes->Length)) {   
							// Translate data bytes to a ASCII String*
							data = System::Text::Encoding::ASCII->GetString(bytes, 0, i);
							insertText(data);
						}

						// Close our connect
						//client->Close();
						
					 }
					 // Close our connect
					 client->Close();

				 } // End While

			 } // End RunIMServer
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code: Managed C# Instant Messanger Client Lop CSharp Tutorials 11 06-02-2008 10:00 AM
Need Help with .NET code for scanning network hoser2001 C# Programming 4 06-20-2007 09:33 AM
What is .NET anyway? DevilsCharm C# Programming 4 07-31-2006 07:38 PM


All times are GMT -5. The time now is 03:33 PM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 65%

Ads