Click here to Skip to main content
15,897,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to turn off hard disk immediately? Pin
ErisonWu2-Feb-05 14:48
ErisonWu2-Feb-05 14:48 
GeneralRe: How to turn off hard disk immediately? Pin
David Crow3-Feb-05 2:39
David Crow3-Feb-05 2:39 
GeneralA Simple Q on Returning Values from a Dialog Pin
LighthouseJ1-Feb-05 13:53
LighthouseJ1-Feb-05 13:53 
GeneralRe: A Simple Q on Returning Values from a Dialog Pin
Ryan Binns1-Feb-05 18:01
Ryan Binns1-Feb-05 18:01 
GeneralRe: A Simple Q on Returning Values from a Dialog Pin
LighthouseJ1-Feb-05 18:24
LighthouseJ1-Feb-05 18:24 
GeneralRe: A Simple Q on Returning Values from a Dialog Pin
David Crow2-Feb-05 3:04
David Crow2-Feb-05 3:04 
GeneralRe: A Simple Q on Returning Values from a Dialog Pin
LighthouseJ2-Feb-05 3:32
LighthouseJ2-Feb-05 3:32 
QuestionHow to tell when a socket is closed? Pin
shultas1-Feb-05 12:53
shultas1-Feb-05 12:53 
Hey all,

I've been toying with making a TCP connection and sending and receiving strings for a couple of days now. I've finally gotten to the point where I can initiate a connection, send some data, and receive some data (I pretty much have a WHILE loop in there listening for certain strings coming back). I'm doing it in the manner of:

CSocket mySocket;
if (mySocket.Connect("192.168.1.105",2000)) {
// while ...
// mySocket.Send();
// mySocket.Receive();
}

All I'm using is CSocket::Connect, Send and Receive. It's working great. I've been stuck for a day now on how to detect when that socket has been closed. (IE, I physically disconnect the LAN cable on the 192.168.1.105 PC). I cannot figure out how to do this. I've read a bunch of articles, and I simply cannot get it to work. I was hoping there was some sort of " if mySocket.IsStillOpen() .... " method existed, but I cannot find one. I'm not sure how to proceeed and was looking for a pointer in the right direction. Any help is extremely appreciated, as this has been a long road to do what seems to be a simple task (I guess I'm a slow learner!)

Thanks much in advance


AnswerRe: How to tell when a socket is closed? Pin
Paul Belikian1-Feb-05 13:52
Paul Belikian1-Feb-05 13:52 
GeneralRe: How to tell when a socket is closed? Pin
shultas1-Feb-05 14:08
shultas1-Feb-05 14:08 
GeneralRe: How to tell when a socket is closed? Pin
Ravi Bhavnani2-Feb-05 2:56
professionalRavi Bhavnani2-Feb-05 2:56 
AnswerRe: How to tell when a socket is closed? Pin
markkuk2-Feb-05 1:00
markkuk2-Feb-05 1:00 
Generaltoolbar problem Pin
a3331-Feb-05 12:23
a3331-Feb-05 12:23 
GeneralDelay calling Pin
DiMats1-Feb-05 11:06
DiMats1-Feb-05 11:06 
GeneralRe: Delay calling Pin
Tom Wright1-Feb-05 11:19
Tom Wright1-Feb-05 11:19 
GeneralRe: Delay calling Pin
DiMats1-Feb-05 11:29
DiMats1-Feb-05 11:29 
GeneralRe: Delay calling Pin
DiMats1-Feb-05 12:59
DiMats1-Feb-05 12:59 
GeneralRe: Delay calling Pin
David Crow2-Feb-05 3:07
David Crow2-Feb-05 3:07 
GeneralRe: Delay calling Pin
DiMats2-Feb-05 3:46
DiMats2-Feb-05 3:46 
GeneralRe: Delay calling Pin
David Crow2-Feb-05 4:03
David Crow2-Feb-05 4:03 
GeneralRe: Delay calling Pin
DiMats2-Feb-05 4:31
DiMats2-Feb-05 4:31 
GeneralUsing a CSocket across thread boundaries Pin
toothless boots1-Feb-05 10:49
toothless boots1-Feb-05 10:49 
GeneralRe: Using a CSocket across thread boundaries Pin
Tom Wright1-Feb-05 10:56
Tom Wright1-Feb-05 10:56 
GeneralRe: Using a CSocket across thread boundaries Pin
toothless boots1-Feb-05 11:04
toothless boots1-Feb-05 11:04 
GeneralClicking Anywhere in Dialog Always Automatically Closes IT Pin
DiMats1-Feb-05 9:57
DiMats1-Feb-05 9:57 

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.