libshout - example.c

libshout documentation | libshout version 1.0.4 - 20000824

# example.c

The example program source:

    #include

    #include
    #include
    #include

    #include

    int main()
    {
    	shout_conn_t conn;
    	char buff[4096];
    	long read, ret, total;

    	shout_init_connection(&conn);

    	conn.ip = "127.0.0.1";
    	conn.port = 8000;
    	conn.password = "letmein";

    	if (shout_connect(&conn)) {
    		printf("Connected to server...\n");
    		total = 0;
    		while (1) {
    			read = fread(buff, 1, 4096, stdin);
    			total = total + read;

    			if (read > 0) {
    				ret = shout_send_data(&conn, buff, read);
    				if (!ret) {
    					printf("DEBUG: Send error: %i...\n", conn.error);
    					break;
    				}
    			} else {
    				break;
    			}

    			shout_sleep(&conn);
    		}
    	} else {
    		printf("Couldn't connect...%i\n", conn.error);
    	}

    	shout_disconnect(&conn);

    	return 0;
    }

copyright © 2000 icecast team | www.icecast.org team@icecast.org
libshout documentation | libshout version 1.0.4 - 20000824