连接错误:请在IOS上使用libshout重试当前操作shoutcast
正在尝试从此服务器使用IOS的libshout库连接到SHOUTcast服务器 link,我发布了iPhone8模拟器的框架,并尝试进行测试,结果出现了这个错误连接错误:请在IOS上使用libshout重试当前操作shoutcast,ios,objective-c,shoutcast,Ios,Objective C,Shoutcast,正在尝试从此服务器使用IOS的libshout库连接到SHOUTcast服务器 link,我发布了iPhone8模拟器的框架,并尝试进行测试,结果出现了这个错误 Warning: Error creating LLDB target at path '/Users/mas/Library/Developer/Xcode/DerivedData/ShoutCast2-gtrwknpcdwrgudfymaufliborewq/Build/Products/Release-iphonesimulato
Warning: Error creating LLDB target at path '/Users/mas/Library/Developer/Xcode/DerivedData/ShoutCast2-gtrwknpcdwrgudfymaufliborewq/Build/Products/Release-iphonesimulator/ShoutCast2.app'- using an empty LLDB target which can cause slow memory reads from remote devices.
-13 is the reply and sucsses = 0
Error connecting: Please retry current operation.
我用来连接和发送mp3到流媒体的代码在这里
shout_t *shout;
int ret;
shout_init();
if (!(shout = shout_new())) {
printf("Could not allocate shout_t\n");
return;
}
if (shout_set_host(shout, "radio.co") != SHOUTERR_SUCCESS) {
printf("Error setting hostname: %s\n", shout_get_error(shout));
return;
}
if (shout_set_protocol(shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS) {
printf("Error setting protocol: %s\n", shout_get_error(shout));
return;
}
if (shout_set_port(shout, 1944) != SHOUTERR_SUCCESS) {
printf("Error setting port: %s\n", shout_get_error(shout));
return;
}
if (shout_set_password(shout, "pass") != SHOUTERR_SUCCESS) {
printf("Error setting password: %s\n", shout_get_error(shout));
return;
}
if (shout_set_mount(shout, "amr") != SHOUTERR_SUCCESS) {
printf("Error setting mount: %s\n", shout_get_error(shout));
return;
}
if (shout_set_user(shout, "kamal") != SHOUTERR_SUCCESS) {
printf("Error setting user: %s\n", shout_get_error(shout));
return;
}
if (shout_set_format(shout, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS) {
printf("Error setting user: %s\n", shout_get_error(shout));
return;
}
if (shout_set_nonblocking(shout, 1) != SHOUTERR_SUCCESS) {
printf("Error setting non-blocking mode: %s\n", shout_get_error(shout));
return;
}
ret = shout_open(shout);
if (ret == SHOUTERR_SUCCESS)
ret = SHOUTERR_CONNECTED;
if (ret == SHOUTERR_BUSY)
printf("Connection pending...\n");
while (ret == SHOUTERR_BUSY) {
printf("Connection busy...");
usleep(10000);
ret = shout_get_connected(shout);
}
printf("%d is the reply and sucsses = %d\n\n", ret, SHOUTERR_SUCCESS);
if (ret == SHOUTERR_CONNECTED) {
printf("Connected to server...\n");
NSData *data = [NSData dataWithContentsOfFile:@"song.mp3"];
NSUInteger length = [data length];
unsigned char *cdata = (int*)malloc(length);
[data getBytes:(void*)cdata length:length];
long long total = 0;
long long size = length;
while (total < size) {
unsigned char *buff[4096];
int read = 0;
for (int i = 0; i < 4096; i++) {
if (total == size)
break;
read++;
buff[i] = cdata[total++];
}
ret = shout_send(shout, buff, read);
if (ret != SHOUTERR_SUCCESS) {
printf("DEBUG: Send error: %s\n", shout_get_error(shout));
break;
}
if (shout_queuelen(shout) > 0)
printf("DEBUG: queue length: %d\n",
(int)shout_queuelen(shout));
shout_sync(shout);
}
} else {
printf("Error connecting: %s\n", shout_get_error(shout));
}
shout_close(shout);
shout_shutdown();
shout\u t*shout;
int ret;
shout_init();
如果(!(shout=shout\u new()){
printf(“无法分配数据”);
返回;
}
如果(shout\u set\u host(shout,“radio.co”)!=shouter\u SUCCESS){
printf(“设置主机名时出错:%s\n”,shout_get_Error(shout));
返回;
}
if(shout\u set\u protocol(shout,shout\u protocol\u HTTP)!=SHOUTERR\u SUCCESS){
printf(“错误设置协议:%s\n”,shout_get_Error(shout));
返回;
}
if(shout\u set\u port(shout,1944)!=shouter\u成功){
printf(“错误设置端口:%s\n”,shout_get_Error(shout));
返回;
}
如果(呼喊设置密码(呼喊“通过”)!=呼喊成功){
printf(“设置密码时出错:%s\n”,shout_get_Error(shout));
返回;
}
如果(呼喊设置安装(呼喊“amr”)!=呼喊成功){
printf(“错误设置装载:%s\n”,shout\u get\u错误(shout));
返回;
}
如果(呼喊设置用户(呼喊“kamal”)!=呼喊成功){
printf(“错误设置用户:%s\n”,shout_get_Error(shout));
返回;
}
if(shout\u set\u format(shout,shout\u format\u MP3)!=shouter\u SUCCESS){
printf(“错误设置用户:%s\n”,shout_get_Error(shout));
返回;
}
如果(呼喊设置非阻塞(呼喊,1)!=呼喊成功){
printf(“设置非阻塞模式时出错:%s\n”,shout_get_Error(shout));
返回;
}
ret=呼喊打开(呼喊);
如果(ret==SHOUTERR\U SUCCESS)
ret=已连接的终端;
如果(ret==SHOUTERR\U BUSY)
printf(“连接挂起…\n”);
while(ret==shoutrr_BUSY){
printf(“连接忙…”);
美国LEEP(10000);
ret=呼出连接(呼出);
}
printf(“%d是回复,成功=%d\n\n”,ret,shouter\u SUCCESS);
如果(ret==SHOUTERR_连接){
printf(“已连接到服务器…\n”);
NSData*data=[NSData data WITH CONTENTS OFFILE:@“song.mp3”];
NSU整数长度=[数据长度];
无符号字符*cdata=(int*)malloc(长度);
[data getBytes:(void*)cdata长度:长度];
长总计=0;
长尺寸=长度;
while(总尺寸<尺寸){
未签名字符*buff[4096];
int read=0;
对于(int i=0;i<4096;i++){
如果(总数==大小)
打破
读++;
buff[i]=cdata[total++];
}
ret=呼喊发送(呼喊、buff、读取);
如果(ret!=SHOUTERR_成功){
printf(“调试:发送错误:%s\n”,shout\u get\u错误(shout));
打破
}
如果(呼喊)>0
printf(“调试:队列长度:%d\n”,
(int)shout_queuelen(shout);;
呼喊同步(呼喊);
}
}否则{
printf(“连接错误:%s\n”,shout_get_Error(shout));
}
呼喊(呼喊);
呼喊关闭();
我已经用C++控制台应用程序测试过了,它工作了,我可以轻松的在没有任何问题的情况下轻松地发送MP3文件,所以我在目标C代码中做了什么错误来给我这个错误?我没有真正的IOS设备可以测试,所以整个模拟器都是如此。
提前谢谢