Click here to Skip to main content
15,904,287 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Silly question about std namespace Pin
Maxwell Chen20-Apr-04 20:59
Maxwell Chen20-Apr-04 20:59 
GeneralRe: Silly question about std namespace Pin
Mike Dimmick21-Apr-04 0:50
Mike Dimmick21-Apr-04 0:50 
GeneralRe: Silly question about std namespace Pin
Jerome Conus21-Apr-04 1:03
Jerome Conus21-Apr-04 1:03 
GeneralVC++ -> Want to modify a binary file that contain "ab 0e" to "0xab 0x0e". Pin
Pankaj Bhalla20-Apr-04 19:51
Pankaj Bhalla20-Apr-04 19:51 
GeneralRe: VC++ -> Want to modify a binary file that contain "ab 0e" to "0xab 0x0e". Pin
Steve S20-Apr-04 22:01
Steve S20-Apr-04 22:01 
GeneralRe: VC++ -> Want to modify a binary file that contain "ab 0e" to "0xab 0x0e". Pin
toxcct20-Apr-04 22:42
toxcct20-Apr-04 22:42 
GeneralRe: VC++ -> Want to modify a binary file that contain "ab 0e" to "0xab 0x0e". Pin
Tim Smith21-Apr-04 3:48
Tim Smith21-Apr-04 3:48 
Generalhelp on winsock problem Pin
psyclope20-Apr-04 18:26
psyclope20-Apr-04 18:26 
I'm developing a client server application using MFC. My server should be able to accept multiple connection from clients (50 clients). I have a problem when I connect two clients, either one of the client will be disconnected. What is the cause of the problem. I'm really stuck and need help on solving the problem.

Here is my server code that accept client connection:

UINT thread(LPVOID p)
{
char recv_msg[3];
CSize size;
size.cx=0;
size.cy=30;
int s,loop,flag=0;
int msgcount;

CVCBUILD2000Dlg *dlg=(CVCBUILD2000Dlg*)AfxGetApp()->GetMainWnd();
msgcount=dlg->getcount();
msgcount = 1;

if (msgcount==-1)
loop=0;

if(loop)
{
dlg->msgsock[msgcount]=accept(dlg->sock,(sockaddr*)&(dlg->serv),&(dlg->addlen));
s=1;

AfxBeginThread(thread,0);
dlg->SetForegroundWindow();
dlg->m_list.InsertItem(dlg->count++,"Connected");
dlg->m_list.InsertItem(dlg->count++,inet_ntoa(dlg->serv.sin_addr));
dlg->m_list.Scroll(size);
dlg->m_button.EnableWindow(TRUE);

//while ERROR_SOCKET not true
while (s!=-1)
{
//get the input from connected PDA
s=recv(dlg->msgsock[msgcount],recv_msg,5,0);
dlg->m_Status.SetWindowText("");
dlg->ChkInput(recv_msg[0], recv_msg[1]);

if (recv_msg[0] == 'F')
{
s = -1;
}

dlg->SetForegroundWindow();
dlg->m_list.Scroll(size);
}

dlg->msgsock[msgcount]=NULL;
for (int i=0;i<3;i++)
if (dlg->msgsock[i]!=NULL)
flag=1;

if (flag != 1)
{
dlg->m_button.EnableWindow(FALSE);
//this calls the function ClearWindow
//pass 1 param (msgsock)
dlg->ClearWindow(msgcount);
closesocket(dlg->msgsock[msgcount]);
dlg->m_list.InsertItem(dlg->count++,"Disconnected");
dlg->m_edit.SetWindowText("");
}
}
AfxEndThread(0);

return 0;
}Confused | :confused:
GeneralRe: help on winsock problem Pin
Paul Ranson21-Apr-04 9:47
Paul Ranson21-Apr-04 9:47 
QuestionHow to map CString to Class Pin
ykutanoor20-Apr-04 18:24
ykutanoor20-Apr-04 18:24 
AnswerRe: How to map CString to Class Pin
Christian Graus20-Apr-04 18:28
protectorChristian Graus20-Apr-04 18:28 
AnswerRe: How to map CString to Class Pin
Mike Dimmick21-Apr-04 0:53
Mike Dimmick21-Apr-04 0:53 
GeneralNewBird: How to...... Pin
tcsiong20-Apr-04 18:01
tcsiong20-Apr-04 18:01 
GeneralRe: NewBird: How to...... Pin
22491720-Apr-04 19:25
22491720-Apr-04 19:25 
QuestionHow to embed a binary file using CArchive Pin
Ted Christiansen20-Apr-04 13:53
Ted Christiansen20-Apr-04 13:53 
AnswerRe: How to embed a binary file using CArchive Pin
Mike Dimmick21-Apr-04 0:57
Mike Dimmick21-Apr-04 0:57 
GeneralRe: generate random ip addresses Pin
John M. Drescher20-Apr-04 16:24
John M. Drescher20-Apr-04 16:24 
GeneralRe: generate random ip addresses Pin
David Crow20-Apr-04 16:30
David Crow20-Apr-04 16:30 
GeneralRe: generate random ip addresses Pin
toxcct20-Apr-04 22:17
toxcct20-Apr-04 22:17 
GeneralRe: generate random ip addresses Pin
Paul Ranson21-Apr-04 9:29
Paul Ranson21-Apr-04 9:29 
Generalfetching selected text Pin
TFB20-Apr-04 12:22
TFB20-Apr-04 12:22 
QuestionWhat does this line of code really do? Pin
Redbehelit20-Apr-04 10:22
Redbehelit20-Apr-04 10:22 
AnswerRe: What does this line of code really do? Pin
David Crow20-Apr-04 10:41
David Crow20-Apr-04 10:41 
AnswerRe: What does this line of code really do? Pin
axid3j1al20-Apr-04 17:22
axid3j1al20-Apr-04 17:22 
AnswerRe: What does this line of code really do? Pin
Mike Dimmick21-Apr-04 1:02
Mike Dimmick21-Apr-04 1:02 

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.