It's not something you deal with at your point as your internet provider will still attempt to deliver the messages to your single IP. So eventually your feed gets overloaded even if you are just reading the packet from the network card and disposing of them because you realize they are junk.
The easiest solution is sign up to a Content Delivery Network, they stop the data ever getting to your server. If you search that term plus your country I am sure you will find some companies to talk to and look at pricing for.
The other option you may want to consider if this is commercial is hiring virtual servers from a VM server farm. They can configure the Virtual server to whatever O/S you need and you run your program on their server. They usually do all the DDOS prevention stuff as part of the deal as they have that stuff already because they have hundreds if not thousands of servers.
thanks a lot bro .. i think that will be so expensive for me .. because i am Arabian .. with dollars will be higher per month ... i will try software can control traffic and filtering as i can .. if you have suggestion for software that will be awesome ... thanks again
I just started to learn C++, coming from a C# and Java background.
I like to use interfaces in my code. In C++ though they do not exist so instead I make structs with pure virtual methods. I'm interested in opinions on different conventions used.
My questions are:
1) From what I understand there is no difference between struct and class besides the default accessor, but it is common place to see struct being used when the class is of a smaller size. Therefore I decided as a convention to use struct when writing interfaces since the way struct is viewed by programmers more closely resembles an interface. Are there any other conventions on this issue or is my convention bad or could cause confusion in any way?
2) Since an interface only has pure virtual and provides no implementation (most of the times, default methods are now a thing in Java) I thought it would be logical to only make a header file for it, instead of making both a .cpp and a .h file. Since a .cpp file is supposed to have the implementation and the .h file is supposed to have the method prototypes. Again, are there any other conventions on this issue or is my convention bad or could cause confusion in any way?
virtualvoid render() = 0;
class Sprite : public IRender
void render() override
//code goes here
What I have tried:
NOTE: My intention is to get the opinion of those with more experience on how my pattern works, if it has problems, and if there is any other convention on issue that my convention is addressing. If you think the question is off topic I would appreciate if you could redirect me to a better place to ask my question. This question for example was marked as off topic on the Code Review Stack Exchange, though in my opinion asking for review on a pattern you in your code is not off topic.
I tend to do exactly the same mainly because if I need I can transfer my C++ code easily to pure C, C# and into VHDL if working with FPGA's. Some will find our coding quirky because they have not come from that interface background but at the end of the day your code is tight and usually more portable to other languages when you need. Personally I think it's a good trait but those who only write in C++ will argue we aren't using the language to it's full ability.
Do you go the whole hog
I import multiple interfaces into things I never do C++ multiple inheritance at all. I also run my own form of delegates, mine is closer to C# that the standard C++ setup.
The final thing I do is probably very quirky to my embedded background, in that all my interfaces have an abstract event drive message function call set on them. Generally it will be unimplemented but the number of times it has saved my butt when I need complicated exchanges across the interfaces to synchronize them or often I use it for live debugging. Saves hours of time if you can connect to a locked program and actually look at the interface states. To do that you simply setup the event drive message pump in it's own thread and so you can actually push messages to get the interface states even though the program thread may be deadlocked.
The only downside is in team developments some will struggle to understand your code because it isn't the purest standard C++ form. On the couple of times I ever had that happen I just hide the interfaces inside a wrapper class, sort of where your sample is going. I normally don't hide the interfaces they just sit as exposed public on a class because they are an designed as a proper interface after all.
1. I generally use a struct if it's only going to have variables. All access has to public anyway since there are no accessor methods.
2. I also have only a .h file for interfaces. Sometimes I have multiple interfaces defined in one .h file.
Posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.
You need to set capture on the mouse if you want the message outside the area. You can grab it when your dialog takes focus or sometimes it is when you select something like select a piece of text to draw. I can't mind read what you are trying to do but you need to set capture on the mouse to get that message outside the client area of the window.
So perhaps start with the simple what starts the fact you want to track the mouse is there an event, a selection process? You want to track the mouse for some reason and whatever starts that process is where you set the capture. When it completes you release the capture. The set capture just needs your window handle and the release call requires no parameters it's a really simple thing and you just need to put the two lines of code in the right place.
The only native window that behaves like that with default behaviour are menu boxes which start the capture when you left mouse click down. They release mouse capture on left mouse click up. That is how you can click an move along menu trees. Perhaps do the same on your dialog so you get the idea. On you dialog handler set capture to start on the left mouse click down and release capture on left mouse click up and you will suddenly see the track outside your window so long as you hold the left button mouse down just like on a menu.
I was doing a job for a company and they don't allow memory allocations to be used you have to request a static block at program start from the memory management unit and then recycle that in your code. You want more there is a whole song and dance you must do. It was a complete pain and then they made the mistake of telling me I could use threads and you could request space for the thread ... so I did apply for 1 thread and got given it.
I offer perhaps the funniest use of a thread ever ... in windows the code would look like this
I figured I would get everything working before dealing with the buffer recycling. It takes a fair bit of work to track what buffers in use and where. What I laughed at was with all the rigor around memory handling I could do it and no-one raised an eyebrow. I mean that is a truely horrible idea.
I will probably recycle one of my memory stream objects and donate it to them because I think the whole manual tracking of buffers is a bit naft and I think just as likely to create program errors as running out of memory.
they don't allow memory allocations to be used you have to request a static block at program start from the memory management unit and then recycle that in your code.
There are good reasons for that:
1. In many cases, it is better to discover that you don't have enough memory at program start than to discover it later.
2. In real-time systems, heap management time can be unpredictable. This makes achieving the time guarantees much more difficult.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
Sorry that is not correct ... running out of memory can be fatal no matter if you allocated it before hand or ran out of it on the heap. In my case I abused the stack which is just as bad.
I am an embedded programmer and I live with low ram implementations in real time systems for a living, and that was the point of my joke at those who think you can frame protection in a standard or a formula. You can't, you need to frame intent and guidelines not specific implementations. You can not create a "safe" or "perfect" specification because you haven't written the code and you don't know the problems.
That whole approach is like 1960's military code specifications and nightmare movie which failed dismally and nobody really codes that way anymore we all use block based approach.
The first public discussion on the new military standards in software I know of was when Boeing allowed hackers to try and hack a "little bird" unmanned helicopter. If you don't know about this stuff that would be a good start point. Hacker-Proof Code Confirmed[^]
As they said you can't hack it and is guaranteed to perform error-free, that isn't a claim it's a provable fact. There are links in the article to the research language F* (F-STAR) and the Project Everest which is Microsofts play in the area of trying to develop better hack free products.
Most new high reliability stuff will follow down those paths for obvious reasons, they can offer guarantees something every other technique can't do.
You are party right any system is better than none ... I understood your intent
Our human systems are always flawed but yeah the new HDL synthesis tool stuff is scary good. Worth playing around with if you have the time and it's fun but quite different way of programming and probably not on Visual Studio until 2050 !!!!
If you allocate memory on the stack... and a recoverable exception occurs in your thread... the memory is correctly released during stack unwinding.
If you allocate memory on the heap and a recoverable exception occurs in your thread... the memory is not released and now your application potentially has a resource leak.
leon de boer wrote:
As they said you can't hack it and is guaranteed to perform error-free, that isn't a claim it's a provable fact.
This is not correct. I have met both Bryan Parno[^] and Jeannette Wing[^] and I was present at the 2014 presentation on campus at Redmond.
Yes, small sections of logic can be statistically proven to be secure. It would not be correct to make the claim of "guaranteed to perform error-free, that isn't a claim it's a provable fact"
If I were to assign a confidence level to what they have achieved I would say "High Confidence".
I have been using SendMessage for interprocess communication.
The Sender Is The Parent console C program. The receiver is a MFC Windows program
All of the sudden it stopped working
I am sure that the windows handle is valid as after The MainFrame is created a (running under the VS debugger) I observe the m_hWnd of the Mainframe. it is the same value returned by the FindWindow (to reterive the windows handle)
I orignally a WM_USER + X and later tried RegisterWindowMessage
The MFC message map (ON_MESSAGE) has message either a #define WM_USER + x or UINT returned
from the RegisterWindowMessage and member handling the message is LRESULT Wparam, Lparam
The issue with SendMessage is that it blocks the calling process until a response is received. Therefore, if something goes wrong in the receiver, the caller tends to hang. So in your situation, my first checks would involve seeing what, if anything, the Mainframe is doing with the message that was sent. Put a breakpoint in the Mainframe's message pump where it catches your registered message, and take it from there. If, by chance, it is not catching your registered message, then there is something amiss with the registration process.
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.