Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Exercises 3: Files, Pipes and SocketsGoal: | ||||||||
Line: 44 to 44 | ||||||||
Once bind was successful (test it!) listen for connect requests on this socket and accept them. Then read messages coming from the client and answer them (e.g. saying:”I saw your message ...”); | ||||||||
Added: | ||||||||
> > | These are is the sequence of actions to make the server work:
The client must
| |||||||
-- Uli Raich - 2017-08-12
Comments |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > |
Exercises 3: Files, Pipes and SocketsGoal:When talking to the sensors during the next exercises we will use a Raspberry Pi to do the readout. Two different libraries are available to easily interface to the sensors:
Exercise 1: Reading and writing filesIn analogy to the way we read and write pipes we will first try to write some text to a file and read it back with another program.Write a C program called fileWrite.c which writes the text: hello #1 hello #2 hello #3 to a text file. This file should be readable to anybody but writable only to its owner and members of the group owning the file. Name the file “text.txt”. Use the system calls
Exercise 2: PipesThis exercises demonstrates the communication between two processes via pipes: Write a program that creates a pipe using the pipe system call. Have a look at the man page for pipe to get more information about this call. Then your program will spawn a second process (use the system call fork), close the unused pipe ends and send some message from the child process to the parent process who prints the message. Compare writing and reading of pipes to writing and reading files.Exercise 3: SocketsNow we will communicate between 2 machines: You will have to write 2 programs:
Comments |