func SocketListen(address string, port string) {
	listener, err := net.Listen("tcp", address+":"+port)
	HandleError(err, true)
	defer listener.Close()

	for {
		connection, err := listener.Accept()
		if HandleError(err, false) {
			log.Println("One of the socket clients has failed to connect", err.Error())
			continue
		}

		clientAddress := connection.RemoteAddr().String()
		log.Println("Client with IP", clientAddress, "has connected via sockets.")
		clientAddressSplit := strings.Split(clientAddress, ":")
		clientIP, clientPort := clientAddressSplit[0], clientAddressSplit[1]

		SocketClients[connection] = &SocketClient{clientIP, clientPort, time.Now(), "", ""}

		go EmulateIcecast(connection)
	}
}
// SocketListen is generally used as a goroutine to listen on TCP
// protocol with given network interface and port and to accept
// any valid connection that are redirected to EmulateIcecast
// function that emulates the Icecast2 protocol.
SocketListen is generally used as a goroutine to listen on TCP
protocol with given network interface and port and to accept
any valid connection that are redirected to EmulateIcecast
function that emulates the Icecast2 protocol.
// SocketListen is generally used as a goroutine to listen on TCP // protocol with given network interface and port and to accept // any valid connection that are redirected to EmulateIcecast // function that emulates the Icecast2 protocol .
func SocketListen(address string, port string) {
	listener, err := net.Listen("tcp", address+":"+port)
	HandleError(err, true)
	defer listener.Close()
	for {
		connection, err := listener.Accept()
		if HandleError(err, false) {
			log.Println("One of the socket clients has failed to connect", err.Error())
			continue
		}
		clientAddress := connection.RemoteAddr().String()
		log.Println("Client with IP", clientAddress, "has connected via sockets.")
		clientAddressSplit := strings.Split(clientAddress, ":")
		clientIP, clientPort := clientAddressSplit[0], clientAddressSplit[1]
		SocketClients[connection] = &SocketClient{clientIP, clientPort, time.Now(), "", ""}
		go EmulateIcecast(connection)
	}
}
func SocketListen ( address string , port string ) { listener , err := net . Listen ( " " , address + " " + port ) HandleError ( err , true ) defer listener . Close ( ) for { connection , err := listener . Accept ( ) if HandleError ( err , false ) { log . Println ( " " , err . Error ( ) ) continue } clientAddress := connection . RemoteAddr ( ) . String ( ) log . Println ( " " , clientAddress , " " ) clientAddressSplit := strings . Split ( clientAddress , " " ) clientIP , clientPort := clientAddressSplit [ 0 ] , clientAddressSplit [ 1 ] SocketClients [ connection ] = & SocketClient { clientIP , clientPort , time . Now ( ) , " " , " " } go EmulateIcecast ( connection ) } }
SocketListen is generally used as a goroutine to listen on TCP
protocol with given network interface and port and to accept
any valid connection that are redirected to EmulateIcecast
function that emulates the Icecast2 protocol.
SocketListen is generally used as a goroutine to listen on TCP protocol with given network interface and port and to accept any valid connection that are redirected to EmulateIcecast function that emulates the Icecast2 protocol .