0

Whether it is possible to connect like socket using C++ with shoutcast v1? Or is the library to do it?

I read http://forums.winamp.com/showthread.php?t=348848 and but it didn't help me - connect failed.

Knowledge
  • 145
  • 1
  • 9
  • Are you trying to play the stream or make a source client? It's just a regular TCP connection. For regular clients, it's very similar to HTTP. – Brad Feb 17 '14 at 00:40
  • Trying to connect to a SHOUTcast server v1 by means of socket. However, the connection fails. – Knowledge Feb 17 '14 at 19:52
  • If the socket connection fails, something else is wrong. Check your firewall and what not. – Brad Feb 17 '14 at 20:00
  • Whether the SHOUTcast server sends some information after connect? – Knowledge Feb 17 '14 at 20:08
  • I don't understand what you are asking. Are you trying to stream audio data from SHOUTcast, or send audio data to it? Are you able to successfully create a TCP connection, or does that connection fail? – Brad Feb 17 '14 at 20:11
  • Trying to connect to a server to send audio data to it. Currently I have a problem with the connection, I do not know how to send password to server. Immediately after the connect? – Knowledge Feb 17 '14 at 20:14
  • That's correct. As soon as you are connected, send the password and `\r\n`. http://stackoverflow.com/a/9241620/362536 – Brad Feb 17 '14 at 20:18
  • Thanks for your help. I was able to connect with the password. But when I send information eg "icy-name: Server name", nothing changes. I need to send audio data? – Knowledge Feb 17 '14 at 20:41
  • Once you send all of your ICY headers, send an extra `\r\n` and then start sending audio data from your encoder. Use Wireshark or some other packet sniffer to verify what is happening. – Brad Feb 17 '14 at 20:43
  • Thanks! And how to send audio data? Open audio like open() and send byte by byte ? – Knowledge Feb 17 '14 at 22:08
  • Yes, but send whole buffers at a time, to optimize transmission. – Brad Feb 17 '14 at 22:10
  • Can You could show me an example? – Knowledge Feb 17 '14 at 22:12
  • No unfortunately, I am not a C++ coder. And, it would depend on what API you were using anyway. – Brad Feb 17 '14 at 22:20
  • I understand. And if this way is ok: http://forums.winamp.com/showthread.php?t=348848? – Knowledge Feb 17 '14 at 22:24
  • Yes, that method looks correct. – Brad Feb 17 '14 at 22:25
  • Cool. And if I need encoder like lame? – Knowledge Feb 17 '14 at 22:27
  • Yes, you definitely need a codec of some sort. You can either interface directly or use STDIO. Also, check out FFmpeg. – Brad Feb 17 '14 at 22:29

0 Answers0