我当前的代码不起作用我找不到发送string
withsendto()
或将 basic 转换string
为 achar*
以便它工作的方法。谢谢。这是我当前的代码:
for (vector<string>::iterator it=lines.begin(); it!=lines.end(); ++it){
if (int bytes = sendto(sockfd, *it, strlen(*it), 0, (struct sockaddr*)&server, svrlen) == -1){
printf("Send error.");
exit(1);
}
}