Usually we use data[44:] to eliminate the header information of wav files, and then assume the rest data is PCM. This may not always be true. For the wav header of a PCMWAVEFORMAT, we can usually understand that a structure as follows is at the front, and then followed by Read more…
To gracefully shutdown a http server requires a few steps.
The http library's serving function will block over there when getting started, until we call http.Server.Close(). As for us, we can invoke the starting function in a goroutine, and call close in another one.
Signal plays an important role in communication with POSIX system.
For example, what if our code been killed, interrupted, hung on? Generally, the operation system (I am talking about BSD, Unix-like, POSIX system, same in the follow but will omitted), will not really "KILL" it, it will just send a kill signal with id to this process, the this process will process this signal later.
Here is a table to describe the id to default action.