|
Hi,
I am writing a small app to connect 2 computers. When i test the server side right from my computer, it 's ok. But because i am using a shared network with a router, my friends cannot connect to my computer by using my IP (because it is a local ip). Can anyone suggest a way to overcome this problem, please?
|
|
|
|
|
You may configure your router for NAT [^], [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
so, that 's means i have to configure something "manually". Is there any solution by using code? I just wonder how p2p apps can work when 2 comps connected directly to each other and one comp is under a shared network
|
|
|
|
|
bubuzzz wrote: I just wonder how p2p apps can work when 2 comps connected directly to each other and one comp is under a shared network
When one of the two peer-to-peer appliacations is inside a private network, you've to configure (manually) the router for NAT .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
bubuzzz wrote: so, that 's means i have to configure something "manually". Is there any solution by using code? I just wonder how p2p apps can work when 2 comps connected directly to each other and one comp is under a shared network OMG
As long as one of the two peers is not firewalled (incoming connections are not blocked), they can make a connection. If both are in a local network without port forwarding it gets much more trickier, but there are still possibilities (as Skype shows).
/M
|
|
|
|
|
Port forwarding is not possible (see router configuration)?
|
|
|
|
|
yup. That is what i am trying these day. Thanks all for replying me
|
|
|
|
|
How do i generate tables in WORD through code? i am creating an application where i have to create tables depending on the input given. for example, if there are 10 objects there should be 10 rows and each row should have an object.
i was trying some examples in CP. couldnt find any.. if somebody can help me it would be great
|
|
|
|
|
There are actually some goo examples about office automation here at CP [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi Members
I am try to show Message when copy file or folder from windows explorer.Is it possible?
|
|
|
|
|
What do you mean?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
You want to show the copy operation progress while it is being performed? Take a look at CopyFileEx[^] function, especially the third parameter.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
i am not going to copy file folder.If copy function of windows is stsrt then i want to show message.If i use CopyFile function then easily i can show message.
I want to show message when windows copy function is start then.
Plz help me
|
|
|
|
|
There is any more opinion.About this topic.
|
|
|
|
|
Hai,
I am having a C++ MFC Application. I have downloaded the original application from a website Metaqoutes.net.I have modified the program & run the pgm.It is wrkng correctly.that is when i build it & debug it,it is wrkng.But when i go to debug folder & running the Application.Exe it is showing the result of the original exe,i.e my changes r nt reflected in that.I am wrkng on VC++9 bt d original program is VC++6.Please help me
|
|
|
|
|
Check your project settings to see what is the output directory.
|
|
|
|
|
I have a project similar to installation program, which has an uninstall app - I hope the uninstall-app deletes all programs including itself - of course failed because it is in running.
I just wandering why normal installation programs, such as inno, can delete uninstallation program itself? what is deep story inside?
any comments?
|
|
|
|
|
|
it is interesting, I will do a test.
thanks
|
|
|
|
|
That's a C# article.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Please see the code bellow.
#include <iostream>
#include <stdlib.h>
using namespace std;
class Cpolygon
{
protected:
int width, height;
public:
void setvalues (int a, int b)
{
width=a;
height=b;
}
};
class Crectangle:public Cpolygon
{
public:
int area ()
{
return(width*height);
}
};
class Ctriagle:public Cpolygon
{
public:
int area()
{
return((width*height)/2);
}
};
int main(int argc, char *argv[])
{
Crectangle rect;
Ctriagle tril;
Cpolygon *Poly1 =▭
Cpolygon *Poly2 =&tril;
Poly1->setvalues(4,5);
Poly2->setvalues(4,5);
cout<<Poly1->area()<<endl;
cout<<Poly2->area()<<endl;
system("PAUSE");
return 0;
}
I have two questions.
1.
Cpolygon *Poly1 =▭
Cpolygon *Poly2 =&tril;
What does these two lines indicate?
2. Instead of creating two objects of base class can we use only one object of base class to set the values.
i.e.
Cpolygon *Poly;
So that
Poly->setvalues(4,5); need to call only once and create the objects of derived class and show the outputs i.e.
Crectangle *rect;
Ctriagle *tril;
cout<<rect->area()<<endl;
cout<<tril->area()<<endl;
will it work?
Thanks for reading.
|
|
|
|
|
Before answering your question, I think there should be a small modification in your code of the Cpolygon class: you should have a virtual area function:
class Cpolygon
{
...
virtual int area() = 0;
};
Otherwise those two lines won't compile:
cout<<Poly1->area()<<endl;
cout<<Poly2->area()<<endl;
First question: you have two pointers to a base class and you make them point to derived classes. This would be more or less similar as this:
Cpolygon *Poly1 = new Crectangle();
Cpolygon *Poly2 =new Ctriangle();
Which is seen more often.
In fact the whole purpose of this code is to show you the use of polymorphism (I suggest you google for it to have a lot more examples). The base principle is that you can manipulate objects of different types (Crectangle and Ctriangle) exactly the same way: they all implement a known interface (Cpolygon). This way, you can store them all in a container and you don't need to know which exact type you are manipulating. Each time you call a virtual function (like area()), it will be "redirected" to the correct type. This is one of the most basic and fundamental principle of object oriented programming.
|
|
|
|
|
A new comers' reply:
For question 1:
Try the step below:
Add "virtual int area() =0;"(of course it is a public member) in the definition of class Cpolygon.
For the lesson, search virtual class on the Internet.
For question 2:
I admire your imagination.
It is possible, but not in your way.
See the use of "constructor". Especially "default constructor."
With ears and eyes.
|
|
|
|