I can't run my server immediately after closing it, it leaves some connection(zombies) leave open after the server is terminated. and i have to wait for some time to run the server again but immediately can't start the server
I have a client/server program. My Client process spawns my server process using a `fork()` and `system()` call. The client and the server are meant to communicate to each other through named piped, that is a requirement of my homework. The client and the server are supposed to initially send a message to the other one, through a pipe, to confirm that a connection is made. My issue is that my client is trying to open one of the named pipes before the server has a chance to make it. This doesn't always happen though. Occasionally, it will run fine. Is there some way to synchronize this?
My overall goal is to get a filename and search target from the user, send those to the server through a named pipe. And the server searches for the target and sends info back.
OUTPUT:
Client: PID 2986 - Running on Tue Sep 30 20:59:28 2014 Client: PID 2986 - Enter File Name: largeSampleText.txt Server PID 2988 - Running on Tue Sep 30 20:59:32 2014 Server: PID 2988 - Synchronized to Client.//This means the client-to-server fifo is working There was an error opening serverToClientfifo//This means client couldn't open the server-to-client fifo error is: 2//This means the fifo doesn't exist yet
[Code] ....
CORRECT OUTPUT:
Client: PID 2542 - Running on Tue Sep 30 20:58:44 2014 Client: PID 2542 - Enter File Name: largeSampleText.txt Server PID 2557 - Running on Tue Sep 30 20:58:54 2014 Server: PID 2557 - Synchronized to Client.
[Code] ....
RELEVANT CLIENT CODE:
int main() { char requestedFileName[1024]; //Get initial information on the client pid_t clientPID = getpid(); time_t currentTime = time(0); char* stringTime= ctime(¤tTime);
[Code] ....
I tried creating both of my fifos in my client and my output changed to this
Client: PID 3150 - Running on Tue Sep 30 21:23:17 2014 Client: PID 3150 - Enter File Name: largeSampleText.txt Client: PID 3150 - Enter Target: Server PID 3153 - Running on Tue Sep 30 21:23:21 2014 was Client: PID 3150 - Input File >>>largeSampleText.txt<<< Client: PID 3150 - Target >>>was<<< Client: PID 3150 - Synchronized to Server Server received unexpected connection message Message: was Terminating
So It appears like the client went ahead and put `requestedFileName` and`requestedTarget`into the pipe and the server read out `requestedTarget` instead of the connection message. Not sure why though
I am working on a Paint program and I have a nice routine (copied from the Net) that beautifully rotates my Image by any chosen degree, and even preserving the entire Image with a 'noclipping' option.
The problem is - That after the rotation, say 45degrees, the areas in the corners, that originally were not part of the Image, cannot be drawn to. I have an 'eye dropper tool' that shows these areas to be null, having no color. My drawing tools will not work on these areas.
public static Bitmap RotateImage(Image image, float rotateAtX, float rotateAtY, float angle, bool bNoClip) { int W, H, X, Y; if (bNoClip) // use Clipping { double dW = (double)image.Width; double dH = (double)image.Height; double degrees = Math.Abs(angle);
I created a .h file for mysql connections. In my example file, I created an array of my class and made connection with the database for each subscript of the class object one by one. Then I checked if the connection in the previous subscripts are active or not, I found all the previous connection are disconnected.
I want to establish multiple connection with database at a time.
My application calls malloc in multiple subroutines, finally releasing all using free. This is done using my zalloc library (see my other post: [URL] .....
Somehow, when the applications tries to detect the available ammount of memory at the end of the test (allocating, freeing, testing), the freemem function gives me about 4-6MB less memory than at the start of the test? (out of 21MB available on the device at the start).
All memory is allocated and freed using the malloc/free routines within the library, with the exception of the SDL functions, which are registered externally on allocation and release.
The Connection class holds the Database Connection ODBC Handle.
The Statement class holds the Statement Handle, there can be multiple per Connection. It is made and destroyed each time a query must be done on the DB.
Now I'm just wondering.
I have a multithreaded application.
Is keeping one Connection for one DB enough for the whole application? Where the different threads will make Statements based on that one Connection.Or is it better to keep a Connection per thread?
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.
I'm currently in the middle of designing a program for some project. one part of the program is to send reminding SMS messages to the employees.
I have already subscribed to a SMS provider that has SMS integration - API. But now I'm wondering how will I be able connect to the SMS server and be able to send messages?
I need to create a client and server program. The client will have a GUI that will display all the available servers (since more than one will be running) in a list box.
I’m guessing a TCP connection will be the best method here, but how will the client find the servers to connect to? I won’t know the IP address of the server because anyone could take the server program and run it on their computer and the client would have to find it.
Is there some way to make the server send some kind of signal that only the client application will be to connect to? So the server will be sending out a signal, the client finds the signal and connects to the server. Is this possible?
i also need to be able to store the IP address the client selects so when the client application is run again it will automatically connect to the server that was stored.
I need to connect and manipulate a DB in SQL Server 2008, but need to have high performance too, so, I want to develop an class in C++ that connect direct to DBMS, in a low level, without using ADO, ODBC or OLEDB.
I found this API [URL] .... which proposes to do exactly what I want, but I need to develop it by myself.
I know this question must have been asked before, but the problem that I am facing is that I am using a library PoDoFo to parse PDF files. It seems that it is only compatible with C++.
Now I want the application to be web-based. That is, the user uploads a PDF file on the server, the server parses it and the parsed content is then sent back to the user.
Is such a thing possible with C++, or maybe any good work-arounds? Or should I look at server-side scripting languages like PHP and their respective libraries?
I am writing a very basic database in C++ and I am accessing the data from a web browser. I am using the opensource Mongoose web server code....
I have an issue...
The way the DB works is this: on starting, the DB loads a json file of all of the data into it. I have a class called DatabaseLoader that does this - it is the class that gets rewritten depending on the data structure of the json.
This is passed to vectors (vector<Node*> and vector<Edge*>) as references from Graph object.
Once the DatabaseLoader has finished it can be destroyed and any memory allocated objects it created (except the ones in those two vectors).
From then on, the Graph object is in charge of all of the elements in the database that are stored in the two vectors. When the user browses to htpp://127.0.0.1:8000 they see the json representing each object in the vectors.
All good so far....
However, when I repeatedly hit refresh in my browser (and call me insane...) at quite a fast speed I get this error:
Code: main(29855,0x7fff76763310) malloc: *** error for object 0x7f98b2829408: incorrect checksum for freed object - object was probably modified after being freed. *** set a breakpoint in malloc_error_break to debug [1] 29855 abort ./main testing.json
It seems to me this would be if I tried to "delete" and object twice, or if one of my objects was overwriting memory somewhere. However I am not recreating anything, I am just looping over the vectors and printing out the content. When I refresh slowly, I dont see this happen - i did it quite a lot of times, but when I do it fast I think it is happening.
So is there any possibility of me hitting the c++ web server to quickly and it is trying to process the data twice, causing some sort of memory error - i.e do I need to implement threading or something??
I can paste code, but there is quite a lot now....
I managed to upload a file to a remote server with below code:
Code: // Get the object used to communicate with the server. FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://kasunl.worlditsme.com/voo.txt"); request.Method = WebRequestMethods.Ftp.UploadFile;
I just started to work on a project which is 'Body Area Network'.
What I need to do is to take data from body with some sensor nodes and send it to mobile which would further send the data to a remote server, and I need to add some security (encryption/decryption) on the data.
So I want to know how to send data from mobile after encrypting it to the server and then decrypt it back(on server side).
I'm currently in the middle of designing a program for some project. one part of the program is to send reminding SMS messages to the employees.
I have already subscribed to a SMS provider and they gave me an access to a control panel (aspx). But now I'm wondering how will I be able connect to the SMS server and be able to send messages?
I'm building a client server which is communicating.I am trying to use the function recvfrom, but have several bugs, so I might have the recvfrom function in the wrong part of my code.
Code:
int talk_with_server(int fd) { printf("Test. "); char buf[LEN]; int n = read(fd, buf, LEN);
I have to make a server-client file transfer using UDP . I have created a basic server which receives message sent by client . That's all. Now comes the major part :-
1. The message sent by client is the name of file .2. Now the server checks whether there exists this file or not . 3. If there exists it sends the file to the client and it also keeps the count of the number of requests of file made by the client . Here is the Server Code
The server reads the data from file and writes into it and send to the client , On the other end client receive the data and make duplicate of this file and write into it. But on compiling it gives error in reading the file.
I was wondering if i had to say simply retrieve data from a server whether it be simple plain text for variables or download whole files (FTP), what would be the best method for this? I would imagine there is a pretty big difference between retrieving text and downloading files but im just wondering what the best thing would be to research for both.
The clients send message to the server and server echo back the message to that particular client. But i want that the server will echo back ones's message to all clients. Suppose 5 clients are connected to the server. So whenever one client send a message to the server, the server will send that message to all 5 clients.
I have loads of movies on DVD and they are all on my media server, but the media server doesn't actually allow streaming to be done, the movies are just stored in a folder on the desktop.
My goal would be able to host all my movies on my LAN server, then build an application to run on a windows based PC at home, not over the Internet just over LAN. For example, say the server I have at home had all the movies in a folder on the desktop, then when I start the client on another PC or laptop in my house, I could view all the movies, choose which one and then stream it to that client PC. I am using C#.NET WPF visual studio.
Maybe I could use something like VLC player to play the movies but I would want to build an client application to view the movies and search for them on the server where the movies are stored. Also I know there are other media streaming programs out there but I want to develop my own one for my uses.