Click here to Skip to main content
15,908,901 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: A window never get focus? Pin
bikram singh13-Jun-04 1:31
bikram singh13-Jun-04 1:31 
AnswerRe: A window never get focus? Pin
toxcct13-Jun-04 3:08
toxcct13-Jun-04 3:08 
GeneralRe: A window never get focus? Pin
Behzad Ebrahimi13-Jun-04 4:24
Behzad Ebrahimi13-Jun-04 4:24 
GeneralRe: A window never get focus? Pin
toxcct13-Jun-04 4:27
toxcct13-Jun-04 4:27 
GeneralRe: A window never get focus? Pin
Behzad Ebrahimi13-Jun-04 4:38
Behzad Ebrahimi13-Jun-04 4:38 
Generalgif format Pin
includeh1012-Jun-04 22:50
includeh1012-Jun-04 22:50 
GeneralRe: gif format Pin
Johan Rosengren12-Jun-04 23:38
Johan Rosengren12-Jun-04 23:38 
GeneralUrgent Requirement-Socket Programming Pin
Billar12-Jun-04 19:18
Billar12-Jun-04 19:18 
Dear Friends,

I am using CAsyncSocket and CSocket for writting a server program. In AsyncSocket I am using
virtual void OnAccept(int nErrorCode);
virtual void OnClose(int nErrorCode);
virtual void OnReceive(int nErrorCode); and also in Socket I am using
virtual void OnAccept(int nErrorCode);
virtual void OnClose(int nErrorCode);
virtual void OnConnect(int nErrorCode);
virtual void OnReceive(int nErrorCode);

Also in the dlg.cpp file,

At InitDialog I am writting
m_cSocketServer.Create(4000);
m_cSocketServer.Listen();

m_cAsyncSocketServer.Create(4000);
m_cSocketServer.Listen();

Also at the Onbutton message I am checking and writting a message into a display like this
void CMFCServerDlg::OnButtonConnection()
{
// TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
char DispBuf[256];
if(m_cSocketServer.Create(4000) && m_cSocketServer.Listen()){
sprintf(DispBuf, "Server Started");
AfxGetMainWnd()->GetDlgItem(IDC_STATIC)->SetWindowText(DispBuf);
}
else{
sprintf(DispBuf, "Connection Failed");
AfxGetMainWnd()->GetDlgItem(IDC_STATIC)->SetWindowText(DispBuf);
}

For other reference....

LRESULT CMFCServerDlg::OnAccept(WPARAM wParam, LPARAM lParam)
{
m_cSocketServer.Accept(m_cAsyncSocketServer);
DestroyFlag = TRUE;
return 0;
}

This is a user message send by the AsyncSocket and Socket from OnAcceptMessage....

My applicaion is very simple and with the above code it is not working. Will you please help to detect the error. Why this code is not suitable to develop a simple server.

Here, I have a dialog box with one button and a text box. Button is for to start a server and text box is nothing but to display a message that server is started.

Please help me to find out the solution.

Thanking You in advance.

Billar



GeneralRe: Urgent Requirement-Socket Programming Pin
includeh1012-Jun-04 22:59
includeh1012-Jun-04 22:59 
GeneralRe: Urgent Requirement-Socket Programming Pin
Billar12-Jun-04 23:29
Billar12-Jun-04 23:29 
GeneralRe: Urgent Requirement-Socket Programming Pin
Yulianto.13-Jun-04 16:18
Yulianto.13-Jun-04 16:18 
GeneralCAsyncSocket Server Pin
Billar12-Jun-04 18:03
Billar12-Jun-04 18:03 
GeneralRe: CAsyncSocket Server Pin
toxcct13-Jun-04 3:12
toxcct13-Jun-04 3:12 
GeneralRe: CAsyncSocket Server Pin
Billar14-Jun-04 3:57
Billar14-Jun-04 3:57 
GeneralDrawing on empty space in MDI app Pin
brdavid12-Jun-04 12:56
brdavid12-Jun-04 12:56 
GeneralRe: Drawing on empty space in MDI app Pin
Joel Lucsy12-Jun-04 14:08
Joel Lucsy12-Jun-04 14:08 
GeneralRe: Drawing on empty space in MDI app Pin
brdavid12-Jun-04 15:11
brdavid12-Jun-04 15:11 
GeneralRe: Drawing on empty space in MDI app Pin
Ravi Bhavnani12-Jun-04 15:13
professionalRavi Bhavnani12-Jun-04 15:13 
GeneralRe: Drawing on empty space in MDI app Pin
brdavid12-Jun-04 16:02
brdavid12-Jun-04 16:02 
Generalskinning windows Pin
testtests12-Jun-04 12:04
testtests12-Jun-04 12:04 
GeneralRe: skinning windows Pin
Scozturk12-Jun-04 23:45
professionalScozturk12-Jun-04 23:45 
QuestionHow do I control which control gets focus? Pin
testtests12-Jun-04 12:02
testtests12-Jun-04 12:02 
AnswerRe: How do I control which control gets focus? Pin
valikac12-Jun-04 14:33
valikac12-Jun-04 14:33 
GeneralRe: How do I control which control gets focus? Pin
testtests12-Jun-04 21:46
testtests12-Jun-04 21:46 
Generalgetting started making a remote access control program Pin
kasmOdia12-Jun-04 10:55
kasmOdia12-Jun-04 10:55 

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.