Click here to Skip to main content
15,883,705 members
Home / Discussions / C#
   

C#

 
QuestionHelp me! Datetimepicker Pin
tphung.hue19-Dec-09 2:27
tphung.hue19-Dec-09 2:27 
AnswerRe: Help me! Datetimepicker Pin
PIEBALDconsult19-Dec-09 4:17
mvePIEBALDconsult19-Dec-09 4:17 
AnswerRe: Help me! Datetimepicker Pin
Saksida Bojan19-Dec-09 6:50
Saksida Bojan19-Dec-09 6:50 
AnswerRe: Help me! Datetimepicker Pin
Saksida Bojan19-Dec-09 8:40
Saksida Bojan19-Dec-09 8:40 
GeneralRe: Help me! Datetimepicker Pin
PIEBALDconsult19-Dec-09 17:31
mvePIEBALDconsult19-Dec-09 17:31 
Questionlan messenger Pin
rawatsunil9218-Dec-09 22:24
rawatsunil9218-Dec-09 22:24 
AnswerRe: lan messenger Pin
OriginalGriff18-Dec-09 22:35
mveOriginalGriff18-Dec-09 22:35 
AnswerRe: lan messenger Pin
dataminers19-Dec-09 8:04
dataminers19-Dec-09 8:04 
CLIENT

SendMessageToClient("192.168.1.3", 8080, textBox1.Text);

private void SendMessageToClient(string pIP, int pPort, string pMessage)
{
try
{
TcpClient tcpClient = new TcpClient();
tcpClient.Connect(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(pIP), pPort));
NetworkStream networkStream = tcpClient.GetStream();
StreamWriter streamWriter = new StreamWriter(networkStream);

streamWriter.WriteLine(pMessage);
streamWriter.Flush();

streamWriter.Close();
networkStream.Close();
}
catch (Exception exception)
{
throw exception;
}
}

--------------------------------------------------------------------------------------------

SERVER

Thread thread = new Thread(new ThreadStart(ListenForSocket));
thread.IsBackground = true;
thread.Start();

private static void ListenForSocket()
{
TcpListener tcpListener = new TcpListener(new System.Net.IPEndPoint(System.Net.IPAddress.Parse("192.168.1.3"), 8080));
tcpListener.Start();

while (true)
{
Socket m_ClientSocket = tcpListener.AcceptSocket();

if (!m_ClientSocket.Connected)
throw new Exception("Not Connect");


NetworkStream networkStream = new NetworkStream(m_ClientSocket);
StreamReader streamReader = new StreamReader(networkStream);

try
{
string message = streamReader.ReadLine();
MessageBox.Show(message);
}
catch (Exception exception)
{
throw exception;
}
}
}
QuestionHow to find the path of a PDF based on corresponding URL opened in IE? Pin
svt gdwl18-Dec-09 19:24
svt gdwl18-Dec-09 19:24 
AnswerRe: How to find the path of a PDF based on corresponding URL opened in IE? Pin
Luc Pattyn19-Dec-09 0:30
sitebuilderLuc Pattyn19-Dec-09 0:30 
Questionhow to write a object data into a file? Pin
santhosh-padamatinti18-Dec-09 19:18
santhosh-padamatinti18-Dec-09 19:18 
AnswerRe: how to write a object data into a file? Pin
dan!sh 18-Dec-09 19:44
professional dan!sh 18-Dec-09 19:44 
AnswerRe: how to write a object data into a file? Pin
OriginalGriff18-Dec-09 22:03
mveOriginalGriff18-Dec-09 22:03 
GeneralRe: how to write a object data into a file? Pin
santhosh-padamatinti19-Dec-09 0:13
santhosh-padamatinti19-Dec-09 0:13 
Questionsocket connection when Messenger behind router Pin
s196675m18-Dec-09 13:09
s196675m18-Dec-09 13:09 
AnswerRe: socket connection when Messenger behind router Pin
Migounette18-Dec-09 13:17
Migounette18-Dec-09 13:17 
Questionhow to send mail with hyperlink and values Pin
treuveni18-Dec-09 10:57
treuveni18-Dec-09 10:57 
AnswerRe: how to send mail with hyperlink and values Pin
Stryder_118-Dec-09 11:13
Stryder_118-Dec-09 11:13 
Questionmanipulate the Title of Application [modified] Pin
Terrakotta00118-Dec-09 10:35
Terrakotta00118-Dec-09 10:35 
AnswerRe: manipulate the Title of Application Pin
DaveyM6918-Dec-09 12:09
professionalDaveyM6918-Dec-09 12:09 
QuestionDoes any one know some decent game programming books? Pin
venomation18-Dec-09 10:31
venomation18-Dec-09 10:31 
AnswerRe: Does any one know some decent game programming books? Pin
Migounette19-Dec-09 7:03
Migounette19-Dec-09 7:03 
QuestionNeed help with CPU app Pin
xploda18-Dec-09 8:02
xploda18-Dec-09 8:02 
QuestionVS C# Windows Service - System.IO.DirectoryNotFoundException: Could not find a part of the path Pin
Tomb42118-Dec-09 5:18
Tomb42118-Dec-09 5:18 
AnswerRe: VS C# Windows Service - System.IO.DirectoryNotFoundException: Could not find a part of the path Pin
EliottA18-Dec-09 5:29
EliottA18-Dec-09 5:29 

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.