Click here to Skip to main content
16,012,223 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: AfxGetApp in a DLL Pin
Johan Rosengren23-Jun-04 3:49
Johan Rosengren23-Jun-04 3:49 
Generaldialog/window active/inactive Pin
Anonymous20-Jun-04 1:59
Anonymous20-Jun-04 1:59 
GeneralRe: dialog/window active/inactive Pin
Ravi Bhavnani20-Jun-04 4:27
professionalRavi Bhavnani20-Jun-04 4:27 
GeneralDLL loading and unloading Pin
SatyaKn20-Jun-04 0:37
SatyaKn20-Jun-04 0:37 
GeneralIconize the application Pin
SatyaKn20-Jun-04 0:26
SatyaKn20-Jun-04 0:26 
GeneralRe: Iconize the application Pin
Ravi Bhavnani20-Jun-04 4:21
professionalRavi Bhavnani20-Jun-04 4:21 
GeneralEnable Frontpage server extensions Pin
namvo19-Jun-04 22:45
namvo19-Jun-04 22:45 
GeneralProblem with select() I think Pin
Abo_Osama19-Jun-04 22:31
Abo_Osama19-Jun-04 22:31 
Mad | :mad: I want to ask something about WinSock. I use it to make connection-Oriented program, I make "PREPARING" for the client and server socket: socket(); setsockopt(SO_RCVTIMEO); set IP address and port for the socket; and finally bind();

For the client, connect(); send(); and there is no SOCKET_ERROR.

Then, for the server, I make listen(); and then the following code:

while(TRUE)
{
iRet=0;
iRet = select(2,&serverReadFD,NULL,NULL,&selectTimeout);
if(iRet == SOCKET_ERROR)
{
AfxMessageBox("ERROR SOCKET SELECT");
closesocket(serverSocket);
return 0;
}
else if(iRet >0)
{
if(FD_ISSET(serverSocket,&serverReadFD))
{
int addrLength=sizeof(sockaddr);
clientConnection = accept(serverSocket,
(struct sockaddr*)&connectionInfo,&addrLength);
if(clientConnection == INVALID_SOCKET)
{
AfxMessageBox("ERROR SOCKET ACCEPT");
closesocket(clientConnection);
closesocket(serverSocket);
return 0;
}
FD_SET(clientConnection,&mainReadFD);
}
else
{
//
iRet = recv(clientConnection,msgData,sizeof(msgData),0);
if(iRet == SOCKET_ERROR)
{
AfxMessageBox("ERROR SOCKET RECEIVE");
closesocket(clientConnection);
closesocket(serverSocket);
return 0;
}
else if(iRet >0)
{
//AfxMessageBox("IN SOCKET RECEIVE");
CString tmp;
tmp.Format("%d",_T(msgData));
::PostMessage(data->mainHandler,WM_DATA_MSG,
(WPARAM)AllocBuffer(tmp),0);
tmp.Insert(0,"REPLAY: ");
iRet = send(clientConnection,(const char*)tmp.GetString(),
tmp.GetLength(),0);
if(iRet == SOCKET_ERROR)
{
AfxMessageBox("ERROR SOCKET SEND");
closesocket(clientConnection);
closesocket(serverSocket);
return 0;
}
memset(msgData,'\0',sizeof(msgData));
}//END RECV CONNECTION
}
}// END SELECT SUCCESS
FD_ZERO(&serverReadFD);
serverReadFD=mainReadFD;
}//while(TRUE)

There is no SOCKET_ERROR either, but the server infinitly receive the Client message "There is no problem in the accept() function".

By debug, I saw that select() return every time the socket that make the connection with the client is ready to receive data.

about the send() functin code in the client thread, here is the code:


while(TRUE)
{
::PeekMessage(&threadMsg,NULL, WM_USER, WM_APP, PM_REMOVE);
if(threadMsg.message == WM_SEND_MSG)
{
iRet = send(clientSocket, (const char*)threadMsg.wParam,
sizeof(threadMsg.wParam), 0);
if( iRet == SOCKET_ERROR )
{
AfxMessageBox("ERROR SOCKET SEND FROM CLIENT");
errorMsgHandler(data->mainHandler, WSAGetLastError());
closesocket(clientSocket);
return 0;
}
}
}//END WHILE (TRUE)

HELP ME PLEASE . . . .

ABO OSAMA
GeneralPlease help me re-compile the original Quake II source code from "ground-up". Pin
Link260019-Jun-04 17:53
Link260019-Jun-04 17:53 
GeneralRe: Please help me re-compile the original Quake II source code from "ground-up". Pin
palbano19-Jun-04 18:49
palbano19-Jun-04 18:49 
GeneralRe: Please help me re-compile the original Quake II source code from "ground-up". Pin
Link260019-Jun-04 20:16
Link260019-Jun-04 20:16 
GeneralNorton commander Pin
mark18219-Jun-04 15:49
mark18219-Jun-04 15:49 
GeneralRe: Norton commander Pin
David Crow21-Jun-04 3:15
David Crow21-Jun-04 3:15 
GeneralDebugging wchar_t in VC6.0 Pin
LasVegasGuy19-Jun-04 10:54
LasVegasGuy19-Jun-04 10:54 
GeneralRe: Debugging wchar_t in VC6.0 Pin
Graham Bradshaw19-Jun-04 11:33
Graham Bradshaw19-Jun-04 11:33 
GeneralRe: Debugging wchar_t in VC6.0 Pin
LasVegasGuy19-Jun-04 15:00
LasVegasGuy19-Jun-04 15:00 
GeneralDialup: cancelling InternetAttemptConnect() Pin
PJ Arends19-Jun-04 8:52
professionalPJ Arends19-Jun-04 8:52 
GeneralRe: Dialup: cancelling InternetAttemptConnect() Pin
palbano19-Jun-04 9:51
palbano19-Jun-04 9:51 
GeneralRe: Dialup: cancelling InternetAttemptConnect() Pin
Nish Nishant19-Jun-04 20:31
sitebuilderNish Nishant19-Jun-04 20:31 
GeneralRe: Dialup: cancelling InternetAttemptConnect() Pin
PJ Arends20-Jun-04 9:16
professionalPJ Arends20-Jun-04 9:16 
GeneralRe: Dialup: cancelling InternetAttemptConnect() Pin
Neville Franks20-Jun-04 12:32
Neville Franks20-Jun-04 12:32 
GeneralRe: Dialup: cancelling InternetAttemptConnect() Pin
PJ Arends21-Jun-04 8:31
professionalPJ Arends21-Jun-04 8:31 
GeneralBug tracking Pin
Nevering19-Jun-04 8:41
Nevering19-Jun-04 8:41 
GeneralRe: Bug tracking Pin
PJ Arends19-Jun-04 9:14
professionalPJ Arends19-Jun-04 9:14 
GeneralRe: Bug tracking Pin
Ravi Bhavnani19-Jun-04 17:23
professionalRavi Bhavnani19-Jun-04 17:23 

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.