C++ :: Threading Over The Network With Pthread Or TBB?

Jun 13, 2013

I'm wondering if there is a library for C++ that supports threading over the network, maybe with a threading pool and a specific protocol; or if there is just a de-facto protocol for doing threading over the network.

View 10 Replies


ADVERTISEMENT

C :: Threading With OpenMP

Apr 10, 2013

I wrote code that finds the number of prime numbers in a range entered by the user. Now I'm attempting to make it run in parallel with the number of threads I assign it to have. I'm using blocking technique, so I'm assigning, in this scenario, 4 threads - 1/4 of the numbers in the range to the first array, and the next 1/4 of the numbers in the range to the next array and so on. Then I want to execute the prime number counting code in parallel. I'm using openMP to do this. I'm having difficulty setting it all up properly. I have a little experience with pthreads but little with openMP and am struggling in how this should be done.

Code:

#include <stdio.h>
#include <stdlib.h>
#include <omp.h>

[Code]....

View 2 Replies View Related

C/C++ :: Threading - How To Pass By Reference

May 13, 2014

I've written some code that I am currently threading but I am unsure how to pass by reference, or rather why my pass by reference is failing.

I am passing an array of floats by reference, this works fine when not threaded but I am given the error that float*&field does not match std::reference_wrapper<float*>.

Anyways. Here's the code.

The method:

diffuse(int b, float*& field, float*& pField, float diffFactor, float dt, int iteration)

The thread:

std::thread diffuseThread(diffuse, 1, std::ref(u), std::ref(prevU), visc, dt, iteration);

View 14 Replies View Related

C/C++ :: Threading / How To Invoke It Properly

Jun 12, 2012

I'm using MS' optimizing compiler CL 13.10 (one from VCToolkit 2003) along with WinAPI threading functions and is being compiled as a C console program.

I was wondering how to implement threading in a production setting? I've seen and tried various examples, but they all show basically the same thing - startup in main, run their function, clean up, and then the program exits.

I don't know the proper terminology, but I was looking for two maybe three functions to run simultaneously with a loop in main. I tried a small test program and was wondering if it's setup correctly.

A structure is used as the argument for each function.

int running = 1; // global variable  
DWORD WINAPI function_1(LPVOID);
DWORD WINAPI function_2(LPVOID);   
main() {  
   HANDLE hndThreads[2];
   DWORD threadIDs[2];

[code].....

Right now, function_2 is just a copy of function_1's definition. Everything *appears* to do what I want, but is it setup correctly?

View 2 Replies View Related

C/C++ :: Threading In Classes Instead Of Main?

Nov 1, 2013

I want to make a thread outside an int main() method; and this code below gives an error of (paraphrasing) 'no constructor found for thread for type void()'

#include <thread>;
class Board(){  
//Lines Later  

[Code]....

Is there any way to accomplish threading outside the main and in a class?

View 1 Replies View Related

C :: Read Text File From Memory Card Using Threading

Mar 25, 2013

I need do read a text file from memory card using threading.

I am able to do it with out using thread but because of some limitations, i have to do it with threading only.

Here is the code to read file from memory card with out thread:

Code: ##########################################
#include <stdio.h>
#include <stdlib.h>
#include <XMC4500.h> /* SFR declarations of the selected device */
#include <DAVE3.h> /* Declarations from DAVE3 Code
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

[Code]...

View 4 Replies View Related

C++ :: Recursive Directory Scan - Can Use Multi-threading For Speed?

May 11, 2014

In our Qt application, we have to load several files on application start-up starting from a root directory.

We are recursively scanning the directories and loading the files.

The total time it takes is about 12 seconds. Can we reduce this time if we use multi-threading?

I have heard that multi-threading does not work everywhere and it increases code complexity and debugging issues.

Would multi-threading solve the above problem? We want it to be platform independent (Mac, Linux, Windows).

View 9 Replies View Related

C++ :: Boost Threading - Cannot Access Private Member Declared In Class

Feb 25, 2013

When I put boost::thread Thread; in my struct I get the error error C2248: 'boost::thread::thread' : cannot access private member declared in class 'boost::thread'

The whole struct is

struct Player {
bool key[256];
char nameString[64];
bool lMouseButton;
bool rMouseButton;
double mouseX;
double mouseY;

[Code] ....

View 1 Replies View Related

C++ :: Why Windows Multi-threading Data Fetch IOPS Too Fast

Feb 10, 2012

I have a SSD and I am trying to use it to simulate my program I/O performance, however, IOPS calculated from my program is much much faster than IOMeter.

My SSD is PLEXTOR PX-128M3S, by IOMeter, its max 512B random read IOPS is around 94k (queue depth is 32). However my program (32 windows threads) can reach around 500k 512B IOPS, around 5 times of IOMeter!!! I did data validation but didn't find any error in data fetching. It's because my data fetching in order?

I paste my code belwo (it mainly fetch 512B from file and release it; I did use 4bytes (an int) to validate program logic and didn't find problem).

#include <stdio.h>
#include <Windows.h>
/*
** Purpose: Verify file random read IOPS in comparison with IOMeter
**/

//Global variables
long completeIOs = 0;
long completeBytes = 0;
int threadCount = 32;
unsigned long long length = 1073741824; //4G test file

[Code] ....

View 1 Replies View Related

C++ :: Method To Loop Through Network IPs

Nov 25, 2013

This problem relates to a program i am developing to ping all hosts on a network.

So far I've managed to access a PostgreSQL database to retrieve a CIDR network address e.g. 192.168.52.14/24.

I have then managed to mask the bits to get the network address.
So for e.g. above its 192.168.52.0

I now need some kind of algorithm to loop through available hosts so from.

192.168.52.0 - 192.168.52.255

I have got as far as deriving the network and separating it into an int array

So I have : ip_start[]= {192,168,52,0}

View 1 Replies View Related

C++ :: Change Network Configuration Using Win32 VC++

Feb 28, 2013

I want to change my system IP, subnet mask, host name etc. using win32 VC++.

I've tried AddIPAddress function but that's not persistent.

I want to change it that it should be change without rebooting system and should be there after restarting the system.

View 3 Replies View Related

C# :: Difference When Starting A Program From Network?

Aug 17, 2012

The following code prevents windows from letting the monitor go into sleep mode when the program is active and wakes the monitor up after a scanner scans something.

Code:
protected override void WndProc(ref Message m) {
if (m.Msg == W32.Const.WM_SYSCOMMAND &&
(m.WParam.ToInt32() & 0xfff0) == W32.Const.SC_MONITORPOWER && m.LParam.ToInt32() != -1)
{
return;

[Code] ....

When the program is started normally it works fine. But when the program is started from a network share it goes to sleep anyway and the OnScan does not work anymore. Removing the Send Message line makes On Scan work again but then the monitor wont wake up on a scan of course.

What could be the problem here when started from the network?

View 1 Replies View Related

C# :: Detect And Disable Network Cards

May 23, 2012

I have an application in c# that i don't want it to connect to the internet in a virtual environment, like virtualbox, vmware virtual pc and so on. Therefore i though that disabling the virtual network card inside the virtual machine would be a good idea.

View 3 Replies View Related

C++ :: Character Recognition With Artificial Neural Network

Feb 3, 2015

create a artificial neural network for character recognition. URL.....Background:

- I have a good understanding of C++ and Assembly code and currently working on my java skills.(PF1, PF2, Paradigms, and microprocessing classes)

-I've programmed microprocessors(PIC) and will be using a PIC32MZ processor to operate the camera data collection and ANN operation. Currently, I plan to program this PIC in Assembly and C since I do not know if C++ will work on the microprocessor hardware.

View 2 Replies View Related

C++ :: Network Programming - Multiplayer Online Game

Oct 1, 2014

How to use c++ to program network for a multiplayer online game or how would i go about this?

View 5 Replies View Related

C# :: Testing Devices For Up / Down Status On External Network?

Jul 11, 2014

I know I can use ping internally to test a device's connectivity. What can I use to test devices on another network (assuming ports are forwarded, and their IP addresses are at my disposal)? I was looking into the TCP Client class.. would that also work with devices using DynDNS?

View 7 Replies View Related

C++ :: Redirecting Network Traffic (building A Proxy)

Feb 3, 2015

I want to build a proxy, middleman between various client programs on my machine and servers outside, like this:

Client -> Proxy -> Server, Client <- Proxy <- Server.

OSes are Windows XP, 7 and 8.

Within that proxy I want to analyze data before it reaches it's destination and have full control over it to the point where I can prevent a packet from reaching it's destination if my program finds something suspisious going on. I need incoming and outgoing traffic of specific adresses and ports to be forwarded into my application on my client machine. My app then should deliver packets to their destination after they were analyzed.

The parts where data is received, analyzed, manipulated if needed, and sent is something I could code with no difficulty. But the concept of redirecting and forwarding is hard for me to grasp at the moment. I'd like to know at least what winsock functions I have to use.

If it's possible, I would like to use Windows libraries only, nothing from 3rd parties.

View 3 Replies View Related

C# :: Mapped Network Drive - Deleting Or Moving A File

Sep 16, 2014

Currently I'm trying to do something extremely basic: delete or move a file

I have a mapped network drive (Y) where I have a file I need to move from one folder to another

First was doing the obvious:

System.IO.File.Move("Y:TempFile.txt", "Y:Temp2File.txt");

Not much to go wrong here, right? As long as I have the correct permission to write in the folders and the folders exists, this would normally go smooth. But for some reason it only copies the file. The source file still exists, but it has successfully copied the file to the destination folder. No exceptions has been thrown or anything... but the file still exists in the source directory

I then changed the code to the following:

System.IO.File.Copy("Y:TempFile.txt", "Y:Temp2File.txt");
System.IO.File.Delete("Y:TempFile.txt");
Console.WriteLine("See mommy, no Exceptions");

As expected the file copies correctly, but the delete command is completely ignored. The file is not deleted, but the Console.WriteLine command is called

I'm running the application as the logged in user. The user has permission to delete the file. If I try from Windows Explorer, the file is correctly deleted. Unfortunately my application refuses to delete the file and even worse, it will not even throw an Exception.

View 10 Replies View Related

C Sharp :: Centralize Database On The System On Local Area Network?

Aug 9, 2013

I wrote an application with wpf and c sharp. And I use ado dotnet framework to connect the database. Now the problem is I want a centralize database for the application. And I hav e installed sql server on one of the which I want to serve as server. I now want all other clients to be able to connect to the database through local area network. how will I do that?

View 2 Replies View Related

Visual C++ :: Application Which Print Existing File On Reception Of Network Event

Sep 10, 2014

I basically want to develop an application which print an existing file on reception of a network event (application will be running on a seven 64 bits PC).

I wonder which application type would be the most suitable (and the simplest) for that (console win32, win32 app, MFC app ...). As this application does not need user intervention (print on network event), I'm not sure that I need a MFC application or a win32 app.

View 9 Replies View Related

C/C++ :: Client To Client Communication Using Network Programming?

Feb 8, 2015

I am trying to make kind of a messenger using Socket/Network Programming

My program should allow clients to register or sign in, after they are signed in they should see a list of the other signed in people whoever I select from that list I should be able to implement using multiple threads as well.

I have done this much:

User.txt file

ahsan,1234
bilal,1234
pappu,1234
babu,1234

Client.c

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>

[code]....

Now issue is in this code I am getting error SEGEMENTATION ERROR, CORE DUMP

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved