How get Icy-MetaData in socket request

I've this code part:

  char *hostAddress;
  hostAddress = "145.58.52.179"; //"http://icecast.omroep.nl";

  int clientSocket = socket(AF_INET, SOCK_STREAM, 0);
  
  // Connect to the server at address: servAddr
  struct sockaddr_in servAddr = {0};
  servAddr.sin_family         = AF_INET;
  servAddr.sin_port           = htons(80);
  inet_aton(hostAddress, &servAddr.sin_addr);
  
  connect(clientSocket, (struct sockaddr*) &servAddr, sizeof(servAddr));
  
  char request[] = "GET / HTTP/1.1\r\n Icy-MetaData=1\r\n\r\n";
  char respons[4096];
  
  send(clientSocket, request, sizeof(request), 0);

It works well, but doesn't give all the output I want.
A command line instruction like this:

curl -H "Icy-MetaData: 1" -v "http://icecast.omroep.nl:80/radio1-bb-mp3" >/dev/null

Does the job very well.
How do I turn this into the GET request?

I assume curl includes an accept header by default. If it does that may be what's missing. Add --trace to curl.

Your header line is incorrectly formatted. Carefully compare the two.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.