Пример #1
0
func (self *Shout) Send(data []byte) (err error) {
	length := len(data)

	res := int(C.shout_send(self.shout,
		(*C.uchar)(unsafe.Pointer(&data[0])),
		(C.size_t)(length)))
	if res != C.SHOUTERR_SUCCESS {
		return self.createShoutError()
	}
	return nil
}
Пример #2
0
func (s *Shout) send(buffer []byte) error {
	ptr := (*C.uchar)(&buffer[0])
	C.shout_send(s.struc, ptr, C.size_t(len(buffer)))

	errno := int(C.shout_get_errno(s.struc))
	if errno != C.SHOUTERR_SUCCESS {
		fmt.Println("something went wrong: %d", errno)
	}

	C.shout_sync(s.struc)
	return nil
}