Click here to Skip to main content
15,886,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Problem in PROCESS_INFORMATION. Pin
Stuart Dootson16-Apr-09 22:35
professionalStuart Dootson16-Apr-09 22:35 
GeneralRe: Problem in PROCESS_INFORMATION. Pin
Le@rner17-Apr-09 0:00
Le@rner17-Apr-09 0:00 
GeneralRe: Problem in PROCESS_INFORMATION. Pin
Stuart Dootson17-Apr-09 0:04
professionalStuart Dootson17-Apr-09 0:04 
GeneralRe: Problem in PROCESS_INFORMATION. Pin
Le@rner17-Apr-09 0:06
Le@rner17-Apr-09 0:06 
GeneralRe: Problem in PROCESS_INFORMATION. Pin
Stuart Dootson17-Apr-09 0:09
professionalStuart Dootson17-Apr-09 0:09 
GeneralRe: Problem in PROCESS_INFORMATION. Pin
Le@rner17-Apr-09 0:10
Le@rner17-Apr-09 0:10 
QuestionHow can get column name from Excel? Pin
Le@rner16-Apr-09 20:05
Le@rner16-Apr-09 20:05 
QuestionProblem with socket program in Client side Pin
Abhijit D. Babar16-Apr-09 20:02
Abhijit D. Babar16-Apr-09 20:02 
Hello All,
I use the following code at Client side to connect with server. In this program, when i start Server, client will stop or hang on the "connect" function. I am not getting where is problem in client program. Server side code i tested, but it is working.

I place the client side code below.

//// Client code ////


CString str;
int sock,iResult,iOptVal,iSenderAddrSize;
int BUFF_SIZE = 30,iError;
char recv_data[30];
char* localIP = "";

struct sockaddr_in server_addr,SenderAddr;
struct hostent * lpHostEntry;
WSADATA wsaData;

iSenderAddrSize = sizeof(SenderAddr);
iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if (iResult != NO_ERROR)
AfxMessageBox(_T("Error at WSAStartup()\n"));

if ((sock = socket(AF_INET, SOCK_STREAM,0)) == -1)
AfxMessageBox(_T("Error at Socket"));

gethostname(localIP,56);
lpHostEntry = gethostbyname(localIP);

server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(2050);
server_addr.sin_addr.s_addr = inet_addr("192.168.1.9");

iError = connect( sock, (SOCKADDR*) &server_addr, sizeof(server_addr) );
if(iError == SOCKET_ERROR){
iError = WSAGetLastError();
CString s1;
s1.Format(_T("Connect Error = %d"),iError);
AfxMessageBox(s1);
exit(1);
}

while(1){
memset(recv_data,0,sizeof(recv_data));
int iResult = recv(sock,recv_data,BUFF_SIZE,0) ;
if(iResult > 0)
{
recv_data[BUFF_SIZE] = '\0';
str = inet_ntoa(SenderAddr.sin_addr);
AfxMessageBox(str);
}
else{
iError = WSAGetLastError();
}
}

///

Pleae see the above code and give some some hint...


Thanks in advance..
AnswerRe: Problem with socket program in Client side Pin
ParagPatel25-Apr-09 1:08
ParagPatel25-Apr-09 1:08 
QuestionSetComputerName not taking effect. No Error in Debug either. Pin
rbwest8616-Apr-09 14:08
rbwest8616-Apr-09 14:08 
AnswerRe: SetComputerName not taking effect. No Error in Debug either. Pin
Luc Pattyn16-Apr-09 14:27
sitebuilderLuc Pattyn16-Apr-09 14:27 
GeneralRe: SetComputerName not taking effect. No Error in Debug either. Pin
rbwest8616-Apr-09 14:41
rbwest8616-Apr-09 14:41 
GeneralRe: SetComputerName not taking effect. No Error in Debug either. Pin
Luc Pattyn16-Apr-09 14:51
sitebuilderLuc Pattyn16-Apr-09 14:51 
GeneralRe: SetComputerName not taking effect. No Error in Debug either. Pin
rbwest8616-Apr-09 14:58
rbwest8616-Apr-09 14:58 
GeneralRe: SetComputerName not taking effect. No Error in Debug either. Pin
Luc Pattyn16-Apr-09 15:06
sitebuilderLuc Pattyn16-Apr-09 15:06 
GeneralRe: SetComputerName not taking effect. No Error in Debug either. Pin
rbwest8616-Apr-09 15:19
rbwest8616-Apr-09 15:19 
GeneralRe: SetComputerName not taking effect. No Error in Debug either. Pin
Luc Pattyn16-Apr-09 15:28
sitebuilderLuc Pattyn16-Apr-09 15:28 
AnswerRe: SetComputerName not taking effect. No Error in Debug either. Pin
Stuart Dootson16-Apr-09 20:42
professionalStuart Dootson16-Apr-09 20:42 
QuestionPDF output for graphical MFC C++ app Pin
John Daleiden16-Apr-09 11:21
John Daleiden16-Apr-09 11:21 
AnswerRe: PDF output for graphical MFC C++ app Pin
Stuart Dootson16-Apr-09 20:51
professionalStuart Dootson16-Apr-09 20:51 
QuestionHow to get a C++ job? Pin
gotchagotcha16-Apr-09 8:21
gotchagotcha16-Apr-09 8:21 
AnswerRe: How to get a C++ job? Pin
Maximilien16-Apr-09 10:36
Maximilien16-Apr-09 10:36 
AnswerRe: How to get a C++ job? Pin
Joe Woodbury16-Apr-09 19:52
professionalJoe Woodbury16-Apr-09 19:52 
GeneralRe: How to get a C++ job? Pin
zhanzongru19-Apr-09 1:33
zhanzongru19-Apr-09 1:33 
QuestionUse Codec Pin
deadlyabbas16-Apr-09 7:38
deadlyabbas16-Apr-09 7:38 

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.