Click here to Skip to main content
15,892,746 members
Home / Discussions / C#
   

C#

 
QuestionHow can I get properties of a class in runtime? Pin
oohungoo27-May-05 18:04
oohungoo27-May-05 18:04 
AnswerRe: How can I get properties of a class in runtime? Pin
Raja Sekhar Amirapu27-May-05 19:03
Raja Sekhar Amirapu27-May-05 19:03 
GeneralCatching exceptions not thrown from Sysem.Exception Pin
Esmo200027-May-05 17:56
Esmo200027-May-05 17:56 
GeneralRe: Catching exceptions not thrown from Sysem.Exception Pin
S. Senthil Kumar27-May-05 20:49
S. Senthil Kumar27-May-05 20:49 
GeneralSystem Events Pin
WiseBuddha27-May-05 14:09
WiseBuddha27-May-05 14:09 
GeneralRe: System Events Pin
S. Senthil Kumar27-May-05 20:53
S. Senthil Kumar27-May-05 20:53 
Generalcreate transparent form with image as background but... Pin
Sasuko27-May-05 12:54
Sasuko27-May-05 12:54 
GeneralDisconnection detection in Tcpclient Pin
Member 143915727-May-05 12:47
Member 143915727-May-05 12:47 
Hi I'm trying to write a simple client/server program in c# were the server only needs to deal with one client at a time.
I wanted to create a new thread to listen for and proccess incoming clients (on the server side).
The thread would look somthing like:
private void serverThread()
{
while(true)
{
tcpClient = tcpListener.AcceptTcpClient();
//create streams and other stuff...
do
{
//get data from the client(read from a stream)
}
while(dataReceived!= clientWantsToDisconnect)
//disconnect and be ready for a new connection
}
}
That is, theres a never ending loop that waits for clients and an inner loop that gets data from them.
If the client sends data indicating he wants to end the connection, theres no problem.
But if the client just disconnects (some kind of an error on the client side or a connection problem), how would i know of it ?
The server would just wait on the line that reads from the stream forever.
How can i know the moment the client is disconnected ?
What i'm looking for is some exception/event that would tell me the connection was severed.
I remember the winsock control in vb6 had events for anything that happend with the connection (I'm trying to write a class that will be similer to that using delegates)
It also had an event that was raised the second it was disconnected, how can i achieve that ?
Thanks for bearing with me...
Ronen.
GeneralRe: Disconnection detection in Tcpclient Pin
S. Senthil Kumar27-May-05 21:03
S. Senthil Kumar27-May-05 21:03 
QuestionHow can I get the identity of a application pool? Pin
Johny Ng27-May-05 12:17
Johny Ng27-May-05 12:17 
GeneralShort filename Pin
bouli27-May-05 10:21
bouli27-May-05 10:21 
GeneralRe: Short filename Pin
John Fisher27-May-05 10:53
John Fisher27-May-05 10:53 
GeneralRe: Short filename Pin
bouli27-May-05 10:55
bouli27-May-05 10:55 
GeneralRe: Short filename Pin
John Fisher27-May-05 11:48
John Fisher27-May-05 11:48 
GeneralRe: Short filename Pin
bouli27-May-05 11:51
bouli27-May-05 11:51 
GeneralRe: Short filename Pin
John Fisher27-May-05 12:21
John Fisher27-May-05 12:21 
GeneralRe: Short filename Pin
bouli27-May-05 12:40
bouli27-May-05 12:40 
GeneralRe: Short filename Pin
John Fisher27-May-05 17:18
John Fisher27-May-05 17:18 
GeneralRe: Short filename Pin
Niklas Ulvinge27-May-05 11:18
Niklas Ulvinge27-May-05 11:18 
GeneralSimple Data BInding Problem Pin
goldoche27-May-05 10:10
goldoche27-May-05 10:10 
GeneralSerialize a Queue Collection Pin
Waleed Eissa27-May-05 9:42
Waleed Eissa27-May-05 9:42 
GeneralRe: Serialize a Queue Collection Pin
MoustafaS27-May-05 9:50
MoustafaS27-May-05 9:50 
GeneralRe: Serialize a Queue Collection Pin
Waleed Eissa27-May-05 9:57
Waleed Eissa27-May-05 9:57 
GeneralRe: Serialize a Queue Collection Pin
Marc Clifton27-May-05 9:55
mvaMarc Clifton27-May-05 9:55 
GeneralRe: Serialize a Queue Collection Pin
Waleed Eissa27-May-05 10:01
Waleed Eissa27-May-05 10:01 

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.