Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: perform action on close [X] button Pin
elephantstar29-Jun-04 9:01
elephantstar29-Jun-04 9:01 
GeneralRe: perform action on close [X] button Pin
Neville Franks29-Jun-04 13:37
Neville Franks29-Jun-04 13:37 
GeneralRe: perform action on close [X] button Pin
elephantstar29-Jun-04 14:56
elephantstar29-Jun-04 14:56 
GeneralRe: perform action on close [X] button Pin
Neville Franks29-Jun-04 15:06
Neville Franks29-Jun-04 15:06 
GeneralRe: perform action on close [X] button Pin
David Crow1-Jul-04 2:21
David Crow1-Jul-04 2:21 
GeneralRe: perform action on close [X] button Pin
elephantstar1-Jul-04 5:55
elephantstar1-Jul-04 5:55 
GeneralRe: perform action on close [X] button Pin
David Crow1-Jul-04 8:05
David Crow1-Jul-04 8:05 
GeneralHELP ME IN THIS PROBLEM Pin
Abo_Osama28-Jun-04 5:44
Abo_Osama28-Jun-04 5:44 
D'Oh! | :doh: hi. . . .
I have a problem in select() function. In the server, this is part of code that handle the setuation of data socket which is checked by select() fn. and it handle closing the client socket "GRACEFULLY OR NUT" so it continue to receive connect()fn. from the client "OR SO I WANT TO DO". but when I do that, the first time the client connect() and closesocket(), it work well. But in the second time the error ((10048: Only one usage of each socket address (protocol/network address/port) is normally permitted)) appeares in the client program. I did not know if the problem from server or the client. This error maybe mean that the socket was not removed from the socket table.


for(sockPos=socketArray.GetStartPosition(); sockPos!=NULL;)
{
socketArray.GetNextAssoc(sockPos,sockArrayKey,(void*&)clientConnection);//CMapStringtoPtr socketArray;
//this is the select(): select(10,&socketReadFD,NULL,&socketErrorFD,&selectTimeout);
//where socketReadFD and socketErrorFD are fd_set type
if(FD_ISSET(clientConnection,&socketReadFD))
{
iRet = recv(clientConnection,msgData,sizeof(msgData), 0);
if(iRet == SOCKET_ERROR)
errorMsgHandler(data->mainHandler, WSAGetLastError());

else if(iRet == 0)
{
//errorMsgHandler(data->mainHandler, WSAGetLastError());
FD_CLR(clientConnection,&mainReadFD);
iRet = closesocket(clientConnection);
if(iRet == SOCKET_ERROR)
errorMsgHandler(data->mainHandler, WSAGetLastError());
socketArray.RemoveKey(sockArrayKey);
}//if close socket from the client Gracefully
else if(iRet >0)
{
CString tmp;
tmp=sockArrayKey;
tmp+=": ";
tmp += msgData;
::PostMessage(data->mainHandler,WM_DATA_MSG,(WPARAM)AllocBuffer(tmp),(LPARAM)AllocBuffer(sockArrayKey));
memset(msgData,'\0',sizeof(msgData));
}//END RECV CONNECTION
}//if FD_ISSET socketReadFD

if(FD_ISSET(clientConnection,&socketErrorFD))
{
errorMsgHandler(data->mainHandler, WSAGetLastError());
FD_CLR(clientConnection,&mainReadFD);
closesocket(clientConnection);
socketArray.RemoveKey(sockArrayKey);
}//if FD_ISSET socketErrorFD
}//sockArray Loop


I wish you to help me in this complex setuation. . .

thanks. . . .

ABO OSAMA
GeneralProblems with Com-Addin Pin
Slowhand0128-Jun-04 5:29
Slowhand0128-Jun-04 5:29 
GeneralRe: Problems with Com-Addin Pin
Anthony_Yio28-Jun-04 17:56
Anthony_Yio28-Jun-04 17:56 
Generaltried to hide a window but the menu bar and tool bar is still shown Pin
Zhang Ming Htmlab28-Jun-04 5:23
Zhang Ming Htmlab28-Jun-04 5:23 
GeneralRe: tried to hide a window but the menu bar and tool bar is still shown Pin
Johan Rosengren28-Jun-04 9:40
Johan Rosengren28-Jun-04 9:40 
GeneralRe: tried to hide a window but the menu bar and tool bar is still shown Pin
Zhang Ming Htmlab29-Jun-04 6:02
Zhang Ming Htmlab29-Jun-04 6:02 
GeneralLoadLibrary Fails :( Pin
Chris Ulliott28-Jun-04 5:20
Chris Ulliott28-Jun-04 5:20 
GeneralRe: LoadLibrary Fails :( Pin
User 665828-Jun-04 5:48
User 665828-Jun-04 5:48 
GeneralRe: LoadLibrary Fails :( Pin
Chris Ulliott28-Jun-04 5:51
Chris Ulliott28-Jun-04 5:51 
GeneralRe: LoadLibrary Fails :( Pin
jmkhael28-Jun-04 6:07
jmkhael28-Jun-04 6:07 
GeneralRe: LoadLibrary Fails :( Pin
Chris Ulliott28-Jun-04 6:14
Chris Ulliott28-Jun-04 6:14 
GeneralRe: LoadLibrary Fails :( Pin
jmkhael28-Jun-04 7:04
jmkhael28-Jun-04 7:04 
GeneralRe: LoadLibrary Fails :( Pin
Chris Ulliott28-Jun-04 23:08
Chris Ulliott28-Jun-04 23:08 
GeneralRe: LoadLibrary Fails :( Pin
David Crow28-Jun-04 7:09
David Crow28-Jun-04 7:09 
GeneralRe: LoadLibrary Fails :( Pin
Chris Ulliott28-Jun-04 23:09
Chris Ulliott28-Jun-04 23:09 
GeneralRe: LoadLibrary Fails :( Pin
vladfein28-Jun-04 7:58
vladfein28-Jun-04 7:58 
GeneralRe: LoadLibrary Fails :( Pin
Chris Ulliott28-Jun-04 23:47
Chris Ulliott28-Jun-04 23:47 
Generalsocket problem Pin
iwanttolearnc28-Jun-04 5:10
iwanttolearnc28-Jun-04 5:10 

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.