C# :: Send Multiple Files Over Tcp At The Same Time In C Sharp?
Nov 29, 2010
I have a tcp client - server implementation running in the same program, on different background worker threads. There will be instances of this program on multiple computers so they can send and receive files between each other. I can send files sequentially between computers using network stream, but how would I send multiple files at the same time from computer A to B.
Sending multiple files over one connection ( socket ) is fine, but having multiple network streams sending data to a client, the client doesn't know which chunk of data is apart of which file ?
View 3 Replies
ADVERTISEMENT
Jun 24, 2013
I have the following code which allows me to add the pdf files if I give the exact name and path of the file. But I have multiple pdf files in a folder which I want to add to each cell in the first column. I am having trouble thinking of the logic to have a for loop for a folder which contains the pdf files.
private void button1_Click(object sender, EventArgs e) {
Excel.Application xlApp;
Excel.Workbook xlWorkBook;
Excel.Worksheet xlWorkSheet;
xlApp = new Excel.ApplicationClass();
xlWorkBook = xlApp.Workbooks.Add(true);
[Code] ...
But this is very very rough draft. I have say 20 files in the folder pdf with different names(Title). How can I add all the 20 pdf files in the excel sheet?
View 6 Replies
View Related
Mar 29, 2013
I'm trying to add a function now that lets the user open 1 or more files and import them to the database and dataGridView. Now the way it is now (should) work. But when it has finished with FILE1, it won't add FILE2 as it then gives me an error that the Column Date Already exists.
My code is below
private void btnOpenLog_Click(object sender, EventArgs e) {
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "Log Files (*.log)|*.log";
openFileDialog1.Multiselect = true;
[Code] .....
View 12 Replies
View Related
Jan 16, 2014
I am writing a piece of code that requires me to display the last 1000 lines from a multiple text files (log files). FYI, I am running on Linux and using g++.
I have a log file from which - if it contains more than 1000 lines, I need to display the last 1000 lines. However, the log file could get rotated. So, in case where the current log file contains less than 1000 lines, I have to go to older log file and display the remaining. For e.g., if log got rotated and new log file contains 20 lines, I have to display the 980 lines from old log file + 20 from current log files.
What is the best way to do this? Even an outline algorithm will work.
View 6 Replies
View Related
Dec 2, 2014
My first time programming sth in Network. I have to use C to send a file to another PC, well COM port are useful but I didn't find how to refer to the address of my destination.
View 4 Replies
View Related
Jul 15, 2013
I'm using multiple C++ files in one project for the first time. Both have need to include a protected (#ifndef) header file. However, when I do that, I get a multiple definition error.
From what I found from research, adding the word inline before the function fixes the error. Is this the right way to do this, and why does it work? Should I make a habbit of just declaring any function that might be used in two .cpp files as inline?
View 5 Replies
View Related
Oct 7, 2012
Have tried to track down the delay? Which function takes that long? Have you printed some logs or measured the time of the functions? No I am not sure how to do that! I debugged it but i didn't see any difference! I definitely think its the logic in the receive code that's "inefficient" what do you think about that? Do you think there's a more efficient way of receiving messages and sending them? Because what I am doing is receiving one then calling send and sending that message out to all users then receiving another one then calling send and sending it out to all users and repeating that process till all the messages are sent, both methods are using a loop to send to all users. DO you think i should receive all messages then send them all out at once? or is that less efficient?
View 4 Replies
View Related
May 12, 2013
I have a program that makes a directory (temporary) and in it some files that are necessary for computation while program is running. Now suppose a user decides to interrupt the program at some stage. what happens is that the program stops but my folder and files remain.
Q: How to override SIGINT command so that before the the execution stops the folder is deleted ?
View 4 Replies
View Related
Aug 16, 2012
I want to send SMS through my C# application.
View 1 Replies
View Related
Sep 26, 2014
i want to send SMS from APP Using Iphone. i can send SMS from andriod but when i connect Iphone so COM PORT can't be detected.
View 1 Replies
View Related
Feb 6, 2015
i want to write a server and a client as below:
The server(and not the clients) will connect to the clients and just send a message. The idea is to be able to connect at each client a different time.
e.g
every 10mins connect at client 1
every 2mins connect at client 2
every 1hour connect at client 3
and so on...
So how to implement this ? Should i create a new child process for each connection and what about the timing ? A pseudo code also will work.
View 4 Replies
View Related
Sep 18, 2013
I'm doing work on chat messenger and facing difficulty to run multiple threads at the same time. Here is the sample code.
void menu();
void groupChat();
void personalChat();
int main() {
sf::Thread thread(&menu());
thread.launch();
[Code] ....
In my program, after menu when he selects a choice, next display of menu wait the termination of the selected thread.
while i want to show menu right after when a menu is selected.
View 2 Replies
View Related
Dec 27, 2012
I'm trying to calculate a series of times from start to end, and find out the duration between them, sum them up and see if they're above a certain value or not, for each particular instance.
My goal is to provide a prepared text file with time tags such as this:
Mon 19-Nov-2012 09:12 Mon 19-Nov-2012 09:34
Wed 21-Nov-2012 13:14Wed 21-Nov-2012 17:11
Fri 07-Dec-2012 15:21Fri 07-Dec-2012 15:26
=============================================
Mon 26-Nov-2012 12:50Tue 27-Nov-2012 15:29
Wed 12-Dec-2012 13:07Wed 12-Dec-2012 14:58
Fri 14-Dec-2012 14:22Fri 14-Dec-2012 14:29
And the program is able to calculate the total time relevant to each instance (instances separated by a line of '=').
Some form of number should somehow identify each instance or something similar and a text file is generated with total time printed for each instance. E.g.
Instance 1: 00h22m + 03h57m + 00h05m = 04h24m
Instance 2: 04h15m + 07h44m + 01h51m + 00h07m = 14h04m
Now I'm currently working on making the logic to calculate time within the ranges I'd like based on several parameters.
Are there any references I can use when it comes to working with strings in order to seek and extract these values in order to work with them? The documentation available on this website, despite being very informative, does not show practical applications of said class and I'm at a loss on how to implement the functionality.
View 17 Replies
View Related
Mar 22, 2013
So I have a rather large (for me) project, requiring me to have two .cpp files and a header. Anyway, both of the .cpp files #include the header file, but I recieve linker errors because the variables and functions in the header are declared and defined twice (once in each .cpp file). How am I supposed to do this?
View 8 Replies
View Related
Sep 24, 2014
We typically don't bother with massive, monolithic code files that get processed from top to bottom. In the Object Oriented world, code files don't mean much. In fact, in C#, I could have multiple classes defined in one file, or have one class split across several files.
View 7 Replies
View Related
Mar 23, 2014
I am struggling with the concept of having different ccp's and header files. I made a really bad example project for representation, but basically my question is are any of the #includes unnecessary that I have? Technically it functions, but if I am doing it wrong I want to prevent myself from starting bad habits in the future. My code just basically uses strings and sets a name and prints it. My code is really bad, but I wanted to just use includes in such a way for a quick example.
//MAIN.CCP
#include "functions.h"
using namespace std;
int main()
[Code]......
View 1 Replies
View Related
May 16, 2012
I am trying to run multiple source files but right after the first one finishes running the program closes and doesn't move on ...
View 2 Replies
View Related
Mar 7, 2013
How I can compile multiple source file in visual studio 2012 ???
View 1 Replies
View Related
Sep 7, 2013
I was trying out programs based on extern and as i understand, this is useful when accessing variables across multiple files having only one definition. But i tried a simple program as below without "extern" and thing seem to work when i expected it would fail during linking process
Code:
file5.c
1 #include <stdio.h>
2 #include "var.h"
3
4 int main() {
5
6 printf("
File5.c a = %d", a);
[Code] .....
As i have included "var.h" in all header files without extern, "int a" would be included in both the .c file and during linking, compiler should have thrown a warning or error message but it compiles file without any issue. Shouldn't var.h have the following "extern int a"?
View 8 Replies
View Related
Apr 9, 2013
I have a big un-editable program, A, which I need to run for like a 1000 different input files. It takes about 15 minutes for each file, so a little parallelisation wouldn't hurt.
I have installed openmpi and it works fine. I have made a small program, B, which selects an input file, moves it to another directory, calls program A with the path to the selected input file and then - when A is done - selects a new input file etc. It should loop until there are no more files in the initial directory.
The problem is this: When I have several processors they might pick the same file and that leads to errors. I have a working program, but it is not pretty.
Code:
#include <stdio.h>
#include <mpi.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int num_procs, procs_id, i, exit;
struct dirent *ent;
[Code]...
Every time a processor tries to move a file that another processor has just moved, the output shows an error message before looping to the next file and trying again. It works, but it is a bit annoying. So my questions are:
1) Can I switch off the error message somehow?
2) Is there a better way to do this?
View 3 Replies
View Related
Aug 2, 2014
So say I create a header file which contains a list of structs, and I want to use these structs through out my source and some of my classes... how would I accomplish this?
When I try to do it via #include, I get re-definition errors, due to the nature of #pragma once. If I switch to #ifndef then I lack defenitions in files other than the source.
Is there a way to define things such as structs across multiple files, which doesn't lead to re-definition errors, and doesn't involve manually re-created all the structs for each file?
View 2 Replies
View Related
Apr 28, 2014
I am currently working on a C++ program for school. I am actually not finding too much difficulty in constructing the functions, enum-types, arrays and structs, however, I am finding great difficulty in using on ifstream variable to open multiple files.
I have posted the entire code that I have so far (even though I have pinpointed the issue to not properly opening the second file in ifstream).
I spent a couple of hours getting rid of certain functions/procedures, loops and variables and I get the same output (if what I removed doesnt crash it). I also get the same output whether I "open" the second file or not (meaning I removed all of the code for it and got the same output).
Here is the code (it's not finished because I am stuck on this file issue). It's a bit messy since I am now in debug mode versus program mode:
View 8 Replies
View Related
Oct 6, 2014
I have been working on code for quite some time and am able to successfully read in a text document and take certain words and information that I need. The issue is that I need to read in close to 100 plus documents and was wondering how I could read in the multiple documents. I thought about creating a structure of arrays and have each text document be an element and walk through taking each document but I am not sure how this works.
View 8 Replies
View Related
Jan 19, 2014
I am trying to get variables that are global to multiple files. I have mananged to make constant variables that are global but maybe not in the best way. In the header i have the constant variables being defined:
const int variable_Name = 5;
And the cpp file:
#include <iostream>
using namespace std;
#include "vars.h"
int main ( ) {
cout << variable_Name<< endl;
system ("pause");
return 0;
}
Is there a better way to do this and to make the variables able to be changed within the cpp files.
View 7 Replies
View Related
May 29, 2014
I am trying to create n number of files (n being an integer), by passing the name through a character array (and obviously changing its value at each iteration). But the problem is that the program compiles and executes but not a single file is created.
Here is my code snippet.
void file_phipsi(int m)
{
int a=0,n=0;
char *str1;
[Code].....
View 4 Replies
View Related
May 7, 2013
I am new to c++ programming i just want to know how to write the data into different files.Suppose my input files has 1-8 ids so each id data must be stored into each different file. And below is my code.
#include<fstream>
#include<iostream>
#include <cstdlib>
#include <algorithm>
#include<list>
#include <math.h>
#include<conio.h>
#include<string>
#define PI 3.14159265
using namespace std;
double angle;
ifstream indata;
ofstream outfile;
[Code] .....
View 1 Replies
View Related