| | |
Fork and exec to run external needed app
![]() |
•
•
Join Date: May 2005
Posts: 18
Reputation:
Solved Threads: 0
Hello,
I have a small app that uses pipes to do some basic client / server communication, just for testing purposes.
Well, when the server is run before the client, it works fine. However, if the client is run before the server, there are problems. To solve this I wanted to start the server from inside the client, if the client sees that there's no server.
This can possibly be done using fork and exec (exec to run the server binary file, replacing the child process's image.
I have been trying to do so, without sucess. I think that scheduling issues may affect the ability to run one from the other - because there are loops both in the server and in the client, that wait for input.
Is this possible or this there another better way to do it?
Thanks for your help.
I have a small app that uses pipes to do some basic client / server communication, just for testing purposes.
Well, when the server is run before the client, it works fine. However, if the client is run before the server, there are problems. To solve this I wanted to start the server from inside the client, if the client sees that there's no server.
This can possibly be done using fork and exec (exec to run the server binary file, replacing the child process's image.
C++ Syntax (Toggle Plain Text)
if ( server_pipe == -1 ) { if ( fork == 0 ) { /* run exec function to start the server */ } }
I have been trying to do so, without sucess. I think that scheduling issues may affect the ability to run one from the other - because there are loops both in the server and in the client, that wait for input.
Is this possible or this there another better way to do it?
Thanks for your help.
•
•
Join Date: May 2005
Posts: 18
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Dogtree
I would think that if there's no server, that's a fatal error for the client. Since this is for testing purposes, why bother with an elaborate workaround when you can simply make sure that you run the server first?
![]() |
Similar Threads
- How to run external .exe programs from java (Java)
- run external program asociated with extension (C)
Other Threads in the C++ Forum
- Previous Thread: Ask a question
- Next Thread: c++ strings
| Thread Tools | Search this Thread |
api array based binary bitmap business c++ c/c++ char class classes code coding commentinghelp compile console conversion count decide delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez graph guess gui homeworkhelp homeworkhelper iamthwee ifpug ifstream incrementoperators infinite input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem proficiency program programming project python random read recursion reference rpg string strings temperature template templates test text text-file tree url variable vector video win32 windows winsock word wordfrequency wxwidgets





