Click here to Skip to main content
15,910,980 members
Home / Discussions / C#
   

C#

 
QuestionServices and Top Most Forms Pin
DUKEMAN29-Jun-06 22:19
DUKEMAN29-Jun-06 22:19 
AnswerRe: Services and Top Most Forms Pin
Martin#29-Jun-06 23:59
Martin#29-Jun-06 23:59 
AnswerRe: Services and Top Most Forms Pin
AB777130-Jun-06 1:37
AB777130-Jun-06 1:37 
GeneralRe: Services and Top Most Forms Pin
DUKEMAN30-Jun-06 1:46
DUKEMAN30-Jun-06 1:46 
AnswerRe: Services and Top Most Forms Pin
pq4noeh30-Jun-06 1:50
pq4noeh30-Jun-06 1:50 
QuestionDataGrid column icon background Pin
Kais4U29-Jun-06 20:44
Kais4U29-Jun-06 20:44 
QuestionA question about Net.Socket? Pin
Phuongkar29-Jun-06 20:05
Phuongkar29-Jun-06 20:05 
AnswerRe: A question about Net.Socket? Pin
stancrm30-Jun-06 0:37
stancrm30-Jun-06 0:37 
Use TcpClient. It is easier then Socket.
using System;
using System.Net.Sockets;
using System.Text;
using System.Threading;

namespace ConsoleApplication25
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
			// Start server
			Thread serverThread = new Thread(new ThreadStart(Server));
			serverThread.Start();

			// Wait 1 second
			Thread.Sleep(1000);

			// Start client
			Thread clientThread = new Thread(new ThreadStart(Client));
			clientThread.Start();
		}

		static void Server()
		{
			byte[] buffer = new byte[1000];

			TcpListener tcpListener = new TcpListener(30000);
			tcpListener.Start();

			TcpClient tcpClient = tcpListener.AcceptTcpClient();
			
			NetworkStream networkStream = tcpClient.GetStream();
			networkStream.Read(buffer, 0, buffer.Length);
			
			string stringReceived = Encoding.ASCII.GetString(buffer).Replace("\0", "");

			Console.WriteLine("Server received : " + stringReceived);
		}

		static void Client()
		{
			string stringToSend = "Hello World";
			byte[] buffer = Encoding.ASCII.GetBytes(stringToSend);
			
			TcpClient tcpClient = new TcpClient();
			tcpClient.Connect("localhost", 30000);
			
			NetworkStream networkStream = tcpClient.GetStream();
		
			Console.WriteLine("Client send : " + stringToSend);

			networkStream.Write(buffer, 0, buffer.Length);
		}
	}
}

QuestionHow to work with panels Pin
JacquesDP29-Jun-06 19:58
JacquesDP29-Jun-06 19:58 
AnswerRe: How to work with panels Pin
Martin#29-Jun-06 20:20
Martin#29-Jun-06 20:20 
GeneralRe: How to work with panels Pin
JacquesDP29-Jun-06 22:16
JacquesDP29-Jun-06 22:16 
Questionchm on-line help Pin
smarttom9929-Jun-06 19:50
smarttom9929-Jun-06 19:50 
AnswerRe: chm on-line help Pin
Glen Harvy29-Jun-06 20:17
Glen Harvy29-Jun-06 20:17 
GeneralRe: chm on-line help Pin
WillemM30-Jun-06 3:35
WillemM30-Jun-06 3:35 
QuestionHow to develop a Distributed Architecture in .NET? Pin
rahulgauttam29-Jun-06 19:31
rahulgauttam29-Jun-06 19:31 
AnswerRe: How to develop a Distributed Architecture in .NET? Pin
WillemM30-Jun-06 4:02
WillemM30-Jun-06 4:02 
QuestionMessagebox Button? in .net 2005 Pin
Rohit Dev29-Jun-06 18:53
Rohit Dev29-Jun-06 18:53 
AnswerRe: Messagebox Button? in .net 2005 Pin
AB777129-Jun-06 21:08
AB777129-Jun-06 21:08 
AnswerRe: Messagebox Button? in .net 2005 Pin
StyleGuide29-Jun-06 22:20
StyleGuide29-Jun-06 22:20 
QuestionDatePicker does not display in Mozilla Firefox Pin
CandyMe29-Jun-06 17:40
CandyMe29-Jun-06 17:40 
AnswerRe: DatePicker does not display in Mozilla Firefox Pin
Abdul Gafoor29-Jun-06 18:01
Abdul Gafoor29-Jun-06 18:01 
GeneralRe: DatePicker does not display in Mozilla Firefox Pin
CandyMe29-Jun-06 21:56
CandyMe29-Jun-06 21:56 
QuestionSending an HTML page by email Pin
IndoKiwi29-Jun-06 13:54
IndoKiwi29-Jun-06 13:54 
AnswerRe: Sending an HTML page by email Pin
Sean8929-Jun-06 14:16
Sean8929-Jun-06 14:16 
QuestionCapture SelectedText from any active window PinPopular
Marian Dumitrascu29-Jun-06 13:51
professionalMarian Dumitrascu29-Jun-06 13:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.