Click here to Skip to main content
15,888,527 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to get started in win32 api Pin
Hamid_RT25-Sep-07 20:41
Hamid_RT25-Sep-07 20:41 
AnswerRe: How to get started in win32 api Pin
David Crow26-Sep-07 3:28
David Crow26-Sep-07 3:28 
AnswerRe: How to get started in win32 api Pin
Jeremy Falcon26-Sep-07 5:25
professionalJeremy Falcon26-Sep-07 5:25 
QuestionResumeThread not calling function Pin
rp_suman25-Sep-07 14:10
rp_suman25-Sep-07 14:10 
AnswerRe: ResumeThread not calling function [modified] Pin
Mark Salsbery25-Sep-07 14:29
Mark Salsbery25-Sep-07 14:29 
AnswerRe: ResumeThread not calling function Pin
Stephen Hewitt25-Sep-07 14:49
Stephen Hewitt25-Sep-07 14:49 
GeneralRe: ResumeThread not calling function Pin
rp_suman25-Sep-07 15:05
rp_suman25-Sep-07 15:05 
Questionif problems Pin
dellthinker25-Sep-07 12:19
dellthinker25-Sep-07 12:19 
Hi all. I made some code that i just cant seem to figure out why its not working like intended.

For some strange reason it was working the way i had hoped until i did a final test and it just seemed to do what it wanted, this may sound strange believe me because i think its strange myself, seeing how it worked one minute and then another it doesnt.

I dont need to post the entire code but just the block thats giving me trouble.

<br />
if(connect(dataSock, (sockaddr*)&structSock, sizeof(sockaddr)) == -1){<br />
		cout << "Connecting to backup server1: " << backupservers[0] << endl;<br />
		ServerAddr1 = gethostbyname(backupservers[0]);<br />
		structSock1.sin_family = AF_INET;   <br />
		structSock1.sin_port = htons(port); <br />
		structSock1.sin_addr.s_addr = *((unsigned long*)ServerAddr1->h_addr_list[0]); <br />
		memset(structSock.sin_zero, 0, 8); <br />
		connect(dataSock, (sockaddr*)&structSock1, sizeof(sockaddr));<br />
	}<br />
	if(connect(dataSock, (sockaddr*)&structSock1, sizeof(sockaddr)) == -1){<br />
		cout << "Connecting to backup server2: " << backupservers[1] << endl;<br />
		ServerAddr1 = gethostbyname(backupservers[1]);<br />
		structSock1.sin_family = AF_INET;   <br />
		structSock1.sin_port = htons(port); <br />
		structSock1.sin_addr.s_addr = *((unsigned long*)ServerAddr1->h_addr_list[0]); <br />
		memset(structSock.sin_zero, 0, 8); <br />
		connect(dataSock, (sockaddr*)&structSock2, sizeof(sockaddr));<br />
	}<br />


The idea here is that if the first connection doesnt work try another, and if that doesnt work try another. The first if function works fine. But the second executes the same time the first if block, which isnt what i want. I want it to wait until the if standards have been met, ie: no connection (-1). But its executing when its not wanted. This is really strange considering i took a short break to come back for one last test just to find out that it wasnt working. Any suggestions? Thanx in advance!
AnswerRe: if problems Pin
Mark Salsbery25-Sep-07 13:09
Mark Salsbery25-Sep-07 13:09 
GeneralRe: if problems Pin
dellthinker25-Sep-07 14:02
dellthinker25-Sep-07 14:02 
GeneralRe: if problems Pin
Mark Salsbery25-Sep-07 14:17
Mark Salsbery25-Sep-07 14:17 
GeneralRe: if problems Pin
dellthinker25-Sep-07 14:20
dellthinker25-Sep-07 14:20 
GeneralRe: if problems Pin
Mark Salsbery25-Sep-07 14:38
Mark Salsbery25-Sep-07 14:38 
QuestionRe: if problems Pin
David Crow26-Sep-07 3:38
David Crow26-Sep-07 3:38 
AnswerRe: if problems Pin
dellthinker26-Sep-07 14:24
dellthinker26-Sep-07 14:24 
QuestionRe: if problems Pin
David Crow26-Sep-07 16:27
David Crow26-Sep-07 16:27 
AnswerRe: if problems Pin
dellthinker30-Sep-07 15:53
dellthinker30-Sep-07 15:53 
QuestionCan't write files with large filenames onto CD/DVD Pin
vijay_aroli25-Sep-07 9:39
vijay_aroli25-Sep-07 9:39 
AnswerRe: Can't write files with large filenames onto CD/DVD Pin
Jeremy Falcon25-Sep-07 10:44
professionalJeremy Falcon25-Sep-07 10:44 
GeneralRe: Can't write files with large filenames onto CD/DVD Pin
vijay_aroli25-Sep-07 10:53
vijay_aroli25-Sep-07 10:53 
QuestionDLL export library ( .lib file) Pin
act_x25-Sep-07 5:35
act_x25-Sep-07 5:35 
AnswerRe: DLL export library ( .lib file) Pin
Jeremy Falcon25-Sep-07 5:44
professionalJeremy Falcon25-Sep-07 5:44 
AnswerRe: DLL export library ( .lib file) Pin
DevMentor.org25-Sep-07 6:57
DevMentor.org25-Sep-07 6:57 
AnswerRe: DLL export library ( .lib file) Pin
VonHagNDaz25-Sep-07 10:56
VonHagNDaz25-Sep-07 10:56 
QuestionDumping values.. Pin
Eytukan25-Sep-07 5:11
Eytukan25-Sep-07 5:11 

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.