15,895,142 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Mr.HA-AS (Top 22 by date)
Mr.HA-AS
1-Apr-14 6:50am
View
I checked it, but for my case I have to swap the logic between readers and writers only, correct? Or do I have to do something else?
Mr.HA-AS
27-Mar-14 18:25pm
View
Yeah, I know. But the rest like zeroMQ, are going on solutions. For example zeroMQ is being used in CERN.
Also message bus mechanism is being adapted by different companies like AllJoyn for IoT.
Mr.HA-AS
27-Mar-14 17:39pm
View
The message bus is a mechanism for IPC, you can check the following site from Microsoft about the mechanism it self:
http://msdn.microsoft.com/en-us/library/ff647328.aspx
For Linux implementation, you can check "D-Bus".
And there's a popular solution zeroMQ which contains bindings for different languages.
I agree with you regarding the multicasting, it's a good solution.
Mr.HA-AS
27-Mar-14 17:03pm
View
For my case the data rate is moderate. Regarding your suggestion, if I want to use sockets, I might have a lot of processes talking to the singleton process. The number of processes is dynamic. So If I want to use Message Bus, I don't have to care about adding or removing a process, whereas for the sockets, each time I add a new process I need to establish p2p connection, correct?
Mr.HA-AS
27-Mar-14 12:04pm
View
Thanks a lot for your answer. But what do you mean by outside of a single system framework?
In my program, I mainly use the Boost library ,and they have an IPC library, which depends on the Shared memory mechanism. so do you recommend me to use it as a solution to the below case?
Currently in my design I have singleton process at sometime this process will send a notification to a certain number of processes to send back their data to it. The singleton process will have to wait until all the data have been collected from different processes. So it's many to one commmunication.
Later at some time, the singleton process will receive some data over a TCP connection, then it has to divide these data and distribute each portion to its corresponding process. So I have one two many communication.
The most important and critical thing, is to exchange the data in a fast way between the processes on the same platform, and without losing any in-flight data " The amount of data is not so big", and I want to have the minimum possible overhead.
I think, I should use some kind of message bus. But I know the message bus will add some overhead in terms of processing and delay, correct or not?
Mr.HA-AS
17-Mar-14 20:48pm
View
Sorry I forgot to mention, why I am splitting my solution too three parts, is because I want to hide the implementation of the low level process the TCP/IP process from the applications, the Abstraction layer will server as a wrapper to use the functions provided by the TCP/IP layer
So when a new application wants to integrate with my solution it will only have to include the library and doesn't need to worry about the TCP/IP process. I hope I made it more clear.
Mr.HA-AS
17-Mar-14 20:08pm
View
Thanks again, as you said I will try different solutions with different setups. Because at the end what is important to me is the E2E Delay ,and Latency. I will come back to you later when I finished testing and tell you about the result and what I found out.
For the current time, I am still in the implementation phase of my project.
Mr.HA-AS
17-Mar-14 19:55pm
View
Thanks again for your great explanation, I think I wasn't clear enough and precise in the description of my problem.
Basically what I need is to establish a communication between my low-level process (TCP-IP process) and the library which contains the APIs, and between the library and different kind of applications like FTP server, Video server, etc. This library should be standardized in away that all applications will know about the APIs and their primitives.
The low-level process will receive some indications and upon the reception of these indications I will make a call to the library, in the same time some applications will have already registered callbacks to this library. So the call to this library actually will make call to these application, which in turn returns back the result to the low-level process.
As a hierarchy, consider I have 3 levels. The top level is application level which might be video server, FTP server. etc. Note: These applications are running independently and are not aware about the low-level process, they only communicate with the library. In the bottom, I have the TCP/IP process which will be running in a standalone mode . And in the middle I have the API layer "The Library", to which all application will register their callbacks.
I want an example for this case, Also I need to know if this design is good or not?
Because there are other methods: like using signals in Linux to tell the application what to do. Or using Message bus as what you suggested, where all the applications will register to it and do sending and receiving , also there's Signal2 library in boost but I found it complicated and didn't know how to use it, and finally there's the UDP/TCP, which I don't prefer in my design.
Thanks a lot :)
Mr.HA-AS
17-Mar-14 19:25pm
View
Thanks a lot for your great explanation. I totally agree with you regarding the creation of the a new thread is cost in terms of performance like memory usage.
Let me explain to you my deployment scenario. In my case I am running my application on a server blade with 16 cores and 32GRAM. And for the users request, they are actually a handover requests to make a handover from one BaseStation to other BaseStation. And from the user perspective, the handover operation is very crucial and needs to be served as fast as possible, otherwise the session will be dropped, and the user has to establish a new session again. That's why I was using a thread per client request.
Also I won't have a high number of users per minute, and the thread live won't last for a long time it's just numbers of milliseconds.
But according to what you have just said, even detach command is a part of the standard library, but it's not a standardized operation for the threads, and I should avoid using it.
So according to what I just said, you still suggest me to replace my current design with your suggested design for thread pool and job queue, or is there even any better solution than that?
And finally I would really like to thank you a lot for great efforts in clarifying everything to me :)
Mr.HA-AS
17-Mar-14 9:34am
View
Again, I was thinking about your first suggestion regarding the socket. But the problem for me the abstraction layer or the API layer should deal with a variable number of applications.
So it's hard to establish a connection between each of them every-time.
I think maybe message bus would serve better. What do you think?
Mr.HA-AS
17-Mar-14 8:12am
View
Thanks a lot for your clear explanation.
But can you give me some examples about the (persistent/non-persistent) message queue?
Mr.HA-AS
17-Mar-14 7:49am
View
Thanks a lot for your answer. But from what I got from your answer using thread.detach() is a bad idea? But why?
It's already a part of the new standard library in c++. And actually it solved my problem for the event_handler. In the reference which describes the detach in c++, they didn't mention anything about this issue.
I am using boost, because my application needs to be cross-platform, that's why.
I also suggested to Sergey to have Thread Pool in the main thread, since this is the main thread and shouldn't be destroyed until the end, but he insisted in telling me that I don't understand thread. And he didn't gave me any good answer, I've provided the code and asked him to explain but no way.
Mr.HA-AS
16-Mar-14 13:57pm
View
You're not getting what I want. Other threads were more helpful. And explained to me what I wanted.
The solution is to use detach() command. And you should keep the main thread not matter what.
So thanks for being a nice and helpful person.
Mr.HA-AS
16-Mar-14 10:23am
View
Check, what I posted now please.
Mr.HA-AS
15-Mar-14 22:33pm
View
I know about the threads, but I believe is my problem is as following:
Consider the previous code without having the join function being executed after the creation of the thread. The newly created thread will start to work in parallel with the function that created it. But when the event_handler reaches the end, it will call the default destructor of the newly created thread which is working in parallel.
And this is what actually happened with me, the program crashed when I did this.
So my question is how to keep the thread alive? what I think is like to have a thread pool outside the scope of the function, am I correct or not?
Mr.HA-AS
15-Mar-14 22:17pm
View
Deleted
But, how can I solve this issue?
Mr.HA-AS
15-Mar-14 22:15pm
View
OK, I modified it.
Mr.HA-AS
15-Mar-14 9:29am
View
Hi, I am following exactly the Boost documentation. I even tried to implement it without the goto jump. But I still get the same problem.
What other alternatives do you suggest? Also if you want more information, please check
http://www.codeproject.com/Questions/744379/Boost-Condition-Variable-problem
Mr.HA-AS
7-Mar-14 8:44am
View
I am asking this question because I got the following errors when I tried to run the following script "test.cc" which is located in scratch folder:
#include "ns3/core-module.h"
#include <boost asio.hpp="">
NS_LOG_COMPONENT_DEFINE ("HelloSimulator");
using namespace ns3;
int
main (int argc, char *argv[])
{
NS_LOG_UNCOND ("Hello Linux");
}
Since I am using boost libraries I used the following command to determine the boost include and libraries:
root@ubuntu:/home/ha/workspace/source/ns-3.19# export BOOSTDIR=/home/ha/boost_1_49_0/
root@ubuntu:/home/ha/workspace/source/ns-3.19# ./waf configure --boost-includes=$BOOSTDIR/include --boost-libs=$BOOSTDIR/lib
And the output was OK:
Checking boost includes : 1_49
Checking boost libs : ok
Checking for boost linkage : ok
But when I run ./waf I get the following errors, below you can see also that boost path is different from what I configured before
Waf: Entering directory `/home/ha/workspace/source/ns-3.19/build'
scratch/test.cc.2.o: In function `__static_initialization_and_destruction_0':=================================================> ][4m26.759s]
/usr/local/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
scratch/test.cc.2.o: In function `boost::asio::error::get_system_category()':
/usr/local/include/boost/asio/error.hpp:216: undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
[48/48][100%][|][==================================================================================================================>][5m22.577s]
Waf: Leaving directory `/home/ha/workspace/source/ns-3.19/build'
Build failed
-> task in 'test' failed (exit status 1):
{task 46775952: cxxprogram test.cc.2.o -> test}
['/usr/bin/g++', '-pthread', '-pthread', '-Wl,-Bsymbolic-functions', '-Wl,-z,relro', 'scratch/test.cc.2.o', '-o', '/home/ha/workspace/source/ns-3.19/build/scratch/test', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-Wl,--no-as-needed', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L/usr/lib', '-lns3.19-test-debug', '-lns3.19-csma-layout-debug', '-lns3.19-point-to-point-layout-debug', '-lns3.19-netanim-debug', '-lns3.19-lte-debug', '-lns3.19-spectrum-debug', '-lns3.19-antenna-debug', '-lns3.19-aodv-debug', '-lns3.19-dsdv-debug', '-lns3.19-dsr-debug', '-lns3.19-mesh-debug', '-lns3.19-olsr-debug', '-lns3.19-csma-debug', '-lns3.19-wimax-debug', '-lns3.19-wave-debug', '-lns3.19-applications-debug', '-lns3.19-virtual-net-device-debug', '-lns3.19-uan-debug', '-lns3.19-energy-debug', '-lns3.19-flow-monitor-debug', '-lns3.19-nix-vector-routing-debug', '-lns3.19-sixlowpan-debug', '-lns3.19-tap-bridge-debug', '-lns3.19-visualizer-debug', '-lns3.19-internet-debug', '-lns3.19-bridge-debug', '-lns3.19-point-to-point-debug', '-lns3.19-mpi-debug', '-lns3.19-wifi-debug', '-lns3.19-buildings-debug', '-lns3.19-propagation-debug', '-lns3.19-mobility-debug', '-lns3.19-config-store-debug', '-lns3.19-emu-debug', '-lns3.19-fd-net-device-debug', '-lns3.19-topology-read-debug', '-lns3.19-network-debug', '-lns3.19-stats-debug', '-lns3.19-core-debug', '-lrt', '-lgsl', '-lgslcblas', '-lm', '-lsqlite3', '-lgtk-x11-2.0', '-lgdk-x11-2.0', '-latk-1.0', '-lgio-2.0', '-lpangoft2-1.0', '-lpangocairo-1.0', '-lgdk_pixbuf-2.0', '-lcairo', '-lpango-1.0', '-lfreetype', '-lfontconfig', '-lgobject-2.
Mr.HA-AS
28-Feb-14 9:58am
View
Because I need to use a specific version for Boost libraries, not the latest one. And as far as I know, you cannot do that when you install Boost library with the Ubuntu distribution
Mr.HA-AS
27-Feb-14 16:29pm
View
Thanks for your answer.
Currently I am working in Linux environment "Ubuntu x64". When I compiled Boost, it installed the binary libraries automatically in /usr/local/lib/ , and this is the path I am using in my command.
Also I already tried to copy the missing file into the current working directory, but I still get the same error.
Mr.HA-AS
24-May-13 10:01am
View
In my c++ project I add UNICODE word in Preprocessor Definitions. Also in my function in VB.NET I added thisenumeration to the SetupChat function CharSet.Unicode as following:
<DllImport("ChatLib32.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Unicode)> _
Private Shared Sub SetupChat(<marshalas(unmanagedtype.lparray)> chatName As Char(), ByVal asAdvertiser As Boolean, ByRef size As Integer)
End Sub
I assume what I did let both VB.Net and VC++ use UNICODE Character Set .But I still get the same result.
Show More