Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Lets stay simple, we will consider you are storing your
- binary sequence in a char[20] for example */
- int main(void) {
- sendToProcess(PID, 12);
- }
- void sendBinarySequence(sequence, PID) {
- loop through sequence {
- /* The best way here is to always send 4 bytes, increment a value so
- the process A don't have to tell you when the sending is done
- */
- if (bit == 1)
- kill(PID, SIGUSR1);
- else if (but == 0)
- kill(PID, SIGUSR2);
- /* Wait for the signal of the process A, we are using ping-pong
- */
- }
- }
- void sendToProcess(PID, NB_TO_SEND) {
- // Send 85 to the process
- char binary[20];
- convertNbToBinary(&binary[0], 85); /* This is the first integrer we
- will send, then the process A will know we will send integrer. */
- sendBinarySequence(binary, PID);
- }
Add Comment
Please, Sign In to add comment