Click here to Skip to main content
15,891,253 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Latest SDK Pin
Michael P Butler15-Oct-03 5:40
Michael P Butler15-Oct-03 5:40 
GeneralRe: Latest SDK Pin
Michael P Butler15-Oct-03 6:06
Michael P Butler15-Oct-03 6:06 
GeneralRe: Latest SDK Pin
thowra15-Oct-03 8:02
thowra15-Oct-03 8:02 
GeneralHashtable Pin
Jajco15-Oct-03 4:47
Jajco15-Oct-03 4:47 
GeneralLosing GDis Pin
alvaro15-Oct-03 4:15
alvaro15-Oct-03 4:15 
QuestionGUID is undefined ??? Pin
Saurabh_Delhi15-Oct-03 4:09
Saurabh_Delhi15-Oct-03 4:09 
GeneralTWAIN Pin
amiolcosta15-Oct-03 3:38
amiolcosta15-Oct-03 3:38 
GeneralTCP help Pin
NewHSKid15-Oct-03 3:11
NewHSKid15-Oct-03 3:11 
Hi all,

I have an app done in MFC, but I am having some problems with the ethernet part. My app is the client end that connects perfectly fine with a server up and running. The problem I am running into is when the server is not up but I type in the IP of it. It continues to say that it is connect. The only error that I ignore is error #10035 WSAEWOULDBLOCK. (i was told that this was an "OK" error) Basically as long as the IP or host name I enter is valid it says it is connected even though there is nothing there to connect to.

How do I fix this problem so it recognize errors such as #10064 WSAEHOSTDOWN or #11001 WSAEHOST_NOT_FOUND

Can someone also please tell me to how to check if at anytime that the connection is lost, reset by peer (or any other error that occurs that will not let me send data to the server) occurs how to immediately tell the user?


Here is the code I am using:
int connection = sock->Create(0, SOCK_STREAM, FD_READ | FD_WRITE, NULL );

if (connection == FALSE)
{
    int ret = sock->GetLastError();
    m_Listbox.AddString("Failed to create socket");
}

else
    m_Listbox.AddString("Socket Created");

int rVal = sock->Connect(servername, port) ;

if (rVal == FALSE)
{
    int	ret = sock->GetLastError();
				
    if(ret == WSAEWOULDBLOCK)
    {
	// Left blank for blocking 
    }
    else
    {
        m_Listbox.AddString("Didn't connect");
        return;
    }
}
else
    m_Listbox.AddString("Connected");

Many thanks in advance

Jimmy

Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
GeneralRe: TCP help Pin
Jesus Oliva15-Oct-03 5:33
Jesus Oliva15-Oct-03 5:33 
Questionsdi application caption? Pin
murali_utr15-Oct-03 2:55
murali_utr15-Oct-03 2:55 
AnswerRe: sdi application caption? Pin
Ravi Bhavnani15-Oct-03 3:36
professionalRavi Bhavnani15-Oct-03 3:36 
GeneralRe: sdi application caption? Pin
murali_utr15-Oct-03 3:50
murali_utr15-Oct-03 3:50 
QuestionHow resize image, GDI+. Thanks forehead. Pin
Babayan Hovhannes15-Oct-03 2:47
Babayan Hovhannes15-Oct-03 2:47 
GeneralList Controls and more controls Pin
Rafael Fernández López15-Oct-03 2:31
Rafael Fernández López15-Oct-03 2:31 
GeneralRe: List Controls and more controls Pin
David Crow15-Oct-03 3:34
David Crow15-Oct-03 3:34 
QuestionVisual C++ .NET - where are the samples? Pin
thowra15-Oct-03 2:08
thowra15-Oct-03 2:08 
AnswerRe: Visual C++ .NET - where are the samples? Pin
Steve S15-Oct-03 2:19
Steve S15-Oct-03 2:19 
GeneralRe: Visual C++ .NET - where are the samples? Pin
thowra15-Oct-03 3:22
thowra15-Oct-03 3:22 
AnswerRe: Visual C++ .NET - where are the samples? Pin
thowra15-Oct-03 4:53
thowra15-Oct-03 4:53 
Generalskin control Pin
a_smith15-Oct-03 1:58
a_smith15-Oct-03 1:58 
GeneralRe: skin control Pin
Anthony_Yio15-Oct-03 2:00
Anthony_Yio15-Oct-03 2:00 
QuestionPager SDK ?? Pin
Fred D.15-Oct-03 1:53
Fred D.15-Oct-03 1:53 
QuestionRegistry value insertion? Pin
murali_utr15-Oct-03 1:33
murali_utr15-Oct-03 1:33 
AnswerRe: Registry value insertion? Pin
Dominik Reichl15-Oct-03 1:43
Dominik Reichl15-Oct-03 1:43 
QuestionHow could I run my exe on other computers ? Pin
Emre Zorlu15-Oct-03 1:24
Emre Zorlu15-Oct-03 1:24 

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.