Click here to Skip to main content
15,896,278 members
Home / Discussions / C#
   

C#

 
GeneralRe: tab control slow Pin
Heath Stewart16-Apr-04 5:51
protectorHeath Stewart16-Apr-04 5:51 
GeneralRe: tab control slow Pin
robmays16-Apr-04 5:57
robmays16-Apr-04 5:57 
GeneralRe: tab control slow Pin
Heath Stewart16-Apr-04 6:00
protectorHeath Stewart16-Apr-04 6:00 
GeneralRe: tab control slow Pin
robmays16-Apr-04 5:52
robmays16-Apr-04 5:52 
GeneralImplementing Security in C# Through Any Hardware Pin
Hemant Mane16-Apr-04 5:30
Hemant Mane16-Apr-04 5:30 
GeneralRe: Implementing Security in C# Through Any Hardware Pin
Heath Stewart16-Apr-04 6:26
protectorHeath Stewart16-Apr-04 6:26 
GeneralRe: Implementing Security in C# Through Any Hardware Pin
partyganger16-Apr-04 10:57
partyganger16-Apr-04 10:57 
Generalthe Form stop to respond Pin
bouli16-Apr-04 4:32
bouli16-Apr-04 4:32 
Hi gurus,

I am currently testing the TcpListener and TcpClient classes from System.Net.Socket to try to send data from a pc to another.

I have inserted a static control that displays the status of the connection.

I do the following code:

<br />
...<br />
				Int32				port=Int32.Parse(txtPort.Text);<br />
				NetworkStream		stream=null;<br />
				Socket				socket=null;<br />
				<br />
				m_server=new TcpListener(IPAddress.Any, port);<br />
                m_server.Start();<br />
<br />
				while (true)<br />
				{<br />
					lblStatus.Text="Waiting for a connection...";<br />
					Debug.WriteLine(lblStatus.Text);<br />
					socket=m_server.AcceptSocket();<br />
<br />
...<br />


When I check the output I can see the message "Waiting for connection..." (that's what I wanted) but the form seems to be completely frozen once the call to socket=m_server.AcceptSocket() is done.
Should I write this function in a separate thread? Then the interface could answer to the OnPaint events like in C++? If I have to write a thread for what I'm doing, where I can I get a sample code for it?

Thanks for the help.

Best regards.


There is no spoon.
GeneralRe: the Form stop to respond Pin
Heath Stewart16-Apr-04 6:31
protectorHeath Stewart16-Apr-04 6:31 
GeneralRe: the Form stop to respond Pin
bouli16-Apr-04 12:05
bouli16-Apr-04 12:05 
GeneralMessage Removed Pin
16-Apr-04 6:47
wibblewibblewibble16-Apr-04 6:47 
GeneralRe: the Form stop to respond Pin
bouli16-Apr-04 12:04
bouli16-Apr-04 12:04 
GeneralPainting Dynamic Objects Pin
TimTM16-Apr-04 4:22
TimTM16-Apr-04 4:22 
GeneralRe: Painting Dynamic Objects Pin
Heath Stewart16-Apr-04 6:35
protectorHeath Stewart16-Apr-04 6:35 
GeneralSourceSafe and References to COM Objects Pin
Andy Wieberneit16-Apr-04 3:50
Andy Wieberneit16-Apr-04 3:50 
GeneralRe: SourceSafe and References to COM Objects Pin
Heath Stewart16-Apr-04 4:05
protectorHeath Stewart16-Apr-04 4:05 
Questionowner draw trackbar? Pin
misterbear16-Apr-04 1:10
misterbear16-Apr-04 1:10 
AnswerRe: owner draw trackbar? Pin
Ernst Kuschke16-Apr-04 3:05
Ernst Kuschke16-Apr-04 3:05 
AnswerRe: owner draw trackbar? Pin
Heath Stewart16-Apr-04 4:14
protectorHeath Stewart16-Apr-04 4:14 
GeneralWord Automation Pin
Dominic Godin16-Apr-04 1:06
Dominic Godin16-Apr-04 1:06 
GeneralRe: Word Automation Pin
Ernst Kuschke16-Apr-04 2:59
Ernst Kuschke16-Apr-04 2:59 
GeneralRe: Word Automation Pin
Dominic Godin16-Apr-04 5:31
Dominic Godin16-Apr-04 5:31 
GeneralRe: Word Automation Pin
Heath Stewart16-Apr-04 5:49
protectorHeath Stewart16-Apr-04 5:49 
GeneralRe: Word Automation Pin
Dominic Godin19-Apr-04 22:06
Dominic Godin19-Apr-04 22:06 
GeneralRe: Word Automation Pin
Heath Stewart20-Apr-04 3:52
protectorHeath Stewart20-Apr-04 3:52 

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.