|
Hi,
in MFC using CSocket or CAsyncSocket following approach can set communication between a client socket and a Connecting socket on server side.
ListeningSocket.Accept ( ConnectingSocket );
Problem, How will multiple clients be implemented?
I have the clue that Link List, Array, Threads might be used for creating multiple connections with multiple clients.
like ListenSock.Accept ( ConnectSock[i] );
BUT how will the messages be handeled. How will one connecting socket differentiate form otherones message.
PLZ HELP !!!!!
RawCoder
|
|
|
|
|
I would strongly recommend NOT using the MFC implementation wrappers for sockets.
The best and *orthodox* way to to use raw sockets WSAEvent etc.
A very good book to but describing the programming of sockets for windows is
"Winsock 2.0" - By Lewis Napper.
|
|
|
|
|
I really need to do it in MFC due to time constraint.
RawCoder
|
|
|
|
|
Hello, the codegurus around the world.
First, you had better understand the concept of TCP/IP.
Server idnetifies the client with IP address and the port number.
This means that the client machine is assigned to the different IP address,
so server can understand the different client with IP address.
So, you may need the other code to restore IP addresses with the current access to the server, and differntiate the incoming socket with IP address.
(I think that this works, but I never implement this level of code. )
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
as far as i know, what can be done is for each client spawn a thread and all the window messages will be handled in that thread. so by this way multiple clients can be done. Sure u can do this using MFC. u can get a lot of source code in internet. may be have a look at www.naughter.com
|
|
|
|
|
"The C++ Programming Language" or "C++ Primer" and why?
|
|
|
|
|
Both,
The primer is elegant in its simplicity describing C++, after you got over the learning curve, "The C++ programming languauge" become your bible, and is much more detailed.
|
|
|
|
|
is there any support for c++ in Linux,
I just want to develop some word pad kind of stuff in c++ for Linux.....
can you give me any info about it....
Gaurav Lambole
webdunia.com (India) pvt.ltd.
|
|
|
|
|
Yes, gcc (Gnu Compiler Collection) contains a very good implementation of C++. It is included in all complete Linux distributions, but it might not be installed by default. There are also various GUI front ends to the compiler, e.g. KDevelop.
|
|
|
|
|
I have to give a data tip on every record(each recod contains three points) on mygraph.For this i am creating
Button controls for every point in for loop as like
MyFuntion(){
for(firstrecord,somerecords(nearly25),lastrecord)
{
CButton *pCon=new CButton;//start point
CButton *pCon1=new CButton;//peak point
CButton *pCon2=new CButton;//end point
pCon.Create(_TEXT(""),WS_VISIBLE|BS_FLAT,CRect,this,Number)
pCon1.Create(_TEXT(""),WS_VISIBLE|BS_FLAT,CRect,this,Number)
pCon2.Create(_TEXT(""),WS_VISIBLE|BS_FLAT,CRect,this,Number)
m_datatip.AddTip(Text,pCon,Number);
m_datatip.AddTip(Text,pCon1,Number);
m_datatip.AddTip(Text,pCon2,Number);
}
}
I am calling this function from OnPaint.
For very first this code is working exactly.When ever
i am calling this function next time the controls not destroying.
I used "delete [] control" ,"delete control" in various places in my function and i didn't get the solution.
Please help me ,
Where can I delete these created controls for callling the Myfunction next time.
|
|
|
|
|
In your header...
typedef CList<cbutton*, cbutton*=""> ButtonList;
class CYourDialog or CWindow.....
{
ButtonList m_listButtons;
}
and when you create the buttons in your cpp implementation file...
m_listButtons.AddTail(pCon1)
m_listButtons.AddTail(pCon2)
... etc
and when your ready to delete the buttons, preferrable as the window/dialog is closing..
while (!m_listButtons.IsEmpty())
delete m_listButtons.RemoveTail();
Normski - Windows Professional Programmer
|
|
|
|
|
Thank you for your Information.
I used this code in my project ,but i didn't detroy all my created buttons.
I am using like this...
MyFunction()
{
CButton *pCon;
for(int i=0;i<15;i++)
{
pCon=new CButton;
pCon->create(_TEXT(""),WS_VISIBLE,CRect(),this,i);
m_buttonlist.AddTail(pCon);
}
//
//my remaining code
//
while(!m_buttonlist.ISEmpty())
{
m_buttonlist.RemoveTail();
pCon->DestroyWindow();
}
In the above attempt the last created button only destroyed.
How can destroy all the created buttons in the for loop;
please help me.
anju
|
|
|
|
|
>while(!m_buttonlist.ISEmpty())
>{
>m_buttonlist.RemoveTail();
>pCon->DestroyWindow();
>}
You forgot to get the pointer to the button when you removed the tail.
while(!m_buttonlist.ISEmpty())
{
pCon = m_buttonlist.RemoveTail();
pCon->DestroyWindow();
}
|
|
|
|
|
ARRRRRAGGGGHHHHHHH!!!!!!!! DELETE!!!!!!!!!!!!!
while(!m_buttonlist.IsEmpty())
{
pCon = m_buttonlist.RemoveTail();
pCon->DestroyWindow();
delete pCon; //always delete when creating with 'new'
}
|
|
|
|
|
thank u sir,
Now the code workig exactly what i need,
once again thank you sir.
|
|
|
|
|
Hi, codegurus from worldwide.
I want to change my IP address and it seems nobody can help me. But i'm tring again now asking all of you.
It is about static IP on any WIN95/98/NT platforms. I know IPCONFIG on NT and WINIPCFG on WIN95/98 is able to do that using inetmib1.dll. So that i've tried to do my job using inetmib1.dll and i managed to do everything but changing those read-write MIBII attributes, including IP address.
For solving my problem, I promise 1000x for that guru of all codegurus in the world and i'll be his fan forever.
Accept my apologize for not such a good English.
|
|
|
|
|
Hi
i see this code in most of the downloaded examples
but what does this code really do ?
Is Dumping of DC really required ?
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#ifdef _DEBUG
void CviewTwo::AssertValid() const
{
CView::AssertValid();
}
void CviewTwo::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
parag
|
|
|
|
|
I have a frame window with multiple different views in. One of them is active at any given time.
When I resize the window, the currently active view behaves fine, but when I switch to one of the others, they keep the size they were before.
So how can I size my view to be as big as the client area of the frame window it is in.
LP
|
|
|
|
|
Hi all!
When a branch is clicked, how do I retrieve the information of its parent and grandParent?
I have not been able to find help in GetParent()and GetParentItem() in the msdn (the help is confusing.)
Thank you
Vu
vucsuf
|
|
|
|
|
CTreeCtrl::GetParentItem
HTREEITEM GetParentItem( HTREEITEM hItem );
Return Value: The handle of the parent item; otherwise NULL.
Parameters: hItem - Handle of a tree item.
Remarks: Call this function to retrieve the parent of hItem.
--Mike--
http://home.inreach.com/mdunn/
"....." -- Silent Bob
your with and
|
|
|
|
|
Hi I'm developing an app using CHtmlView and I need to handle bidirectional comunication between my derived CHtmlView class, and one CMouse class that handles mouse events. When some action is done with the moose, i handle the events, and based in some values i must call a function from the derived CHtmlView class. Any idea how can I get this done?? Tnx
|
|
|
|
|
Give each class a pointer to the instance of the other. You'll need in at least one case to put a dummy class declaration in the .h file, and #include the real one in the .cpp, or you'll have a circular include thing happening.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Nop doesn't work or i'm not getting it. Could u give me an example? Tnx
|
|
|
|
|
It *does* work, it's the only way really to do it. Post the code you're using and I'd be glad to have a look at it.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I've got a CHtml2View class that it's inherited from CHtmlView.
And I've got another one CMouse that handle mouse events. Somebody(I don't remember his name..) give me this code for getting mouse events. This is inside
CHml2View::OnDocumentComplete
CWnd * m_Wnd = GetWindow( GW_CHILD );
if (m_Wnd)
{
m_Wnd = m_Wnd->GetWindow( GW_CHILD );
if (m_Wnd)
{
m_Wnd = m_Wnd->GetWindow( GW_CHILD );
if (m_Wnd)
{
m_MouseWnd.SubclassWindow(m_Wnd->m_hWnd);
}
}
}
This m_mouseWnd is an instance of my CMouse class. And in the .h file of CHtml2View i've got an #include "Mouse.h" and the public variable m_mouseWnd in CMouse i've got a function that handle the right button click event. Like this
OnRButtonDown(UINT nFlags, CPoint point)
This part is workin, but i need to call back a funtion of CHtml2View called Execute, and I dont'k know how to do it, if I do an #include "Html2View.h" in Mouse.h or Mouse.cpp I've get a lot of errors !! If u need more details just ask me please. Tnx
|
|
|
|