Implement a small program that reads /proc/net/tcp every 10 seconds and outputs any new connections.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
327 B

package main
import (
"fmt"
"io/ioutil"
)
func check(e error) {
if e != nil {
panic(e)
}
}
func read_connections_file() {
var connections_file_path string = "/proc/net/tcp"
data, err := ioutil.ReadFile(connections_file_path)
check(err)
fmt.Println(string(data))
}
func main() {
read_connections_file()
}