Esempio n. 1
0
func (us *UnixSock) processBuffer(fd io.ReadWriter) {
	var buf [1024]byte

	for {
		n, err := fd.Read(buf[0:])
		if err != nil || n == 0 {
			break
		}
		us.data <- pipe.NewSimpleChunk(buf[0:n])
	}
}
Esempio n. 2
0
func (us *UDPSource) Run(l *net.UDPConn) {
	// Why doesn't this get called on ctrl + c
	var buf [1024]byte

	for {
		n, err := l.Read(buf[0:])
		if err != nil || n == 0 {
			break
		}
		us.data <- pipe.NewSimpleChunk(buf[0:n])
	}
}