我的代码在Mac OS Lion上的Safari 6.1.2以外的其他浏览器上运行得非常好.
以下是我使用的ajax帖子 -
$.ajax({
type: 'POST',
dataType: 'text/html',
url:"/MyProxy.php",
data:{"server":"mydomain.com", "user":"vijay", "passd":"highly@secret"},
error: function(data) {
console.log(data);
alert("Failure - "+data);
return;
},
success: function(data) {
console.log("Success - "+data);
parseInformation(data);
}
});
Run Code Online (Sandbox Code Playgroud)
同样出于调试目的,我在PHP服务器代码上输入了日志
header('cache-control: no-cache');
function getRealPOST() {
$pairs = explode("&", file_get_contents("php://input"));
$vars = array();
foreach ($pairs as $pair) {
$nv = explode("=", $pair);
$name = urldecode($nv[0]);
$value = urldecode($nv[1]);
$vars[$name] = $value;
}
return $vars;
}
echo "-------";
var_dump($_POST);
echo "-------";
print_r(getRealPOST());
Run Code Online (Sandbox Code Playgroud)
在Safari上的控制台日志中显示如下内容:
-------array(2) {
["userName"]=>
string(5) "vijay" …Run Code Online (Sandbox Code Playgroud) 我有一个套接字等待接收数据,然后在接收数据后,向前发送数据进行处理。但是,然后它再次进行 recv,这次它没有收到任何返回 -1 并且在打印 errno 时它会打印 35(即EAGAIN)。
这只发生在 MAC OS Lion 操作系统上,对于其他操作系统,它运行得非常好
do{
rc = recv(i, buffer, sizeof(buffer), 0);
if (rc < 0){
printf("err code %d", errno);
}
if(rc == 0){
//Code for processing the data in buffer
break;
}
....
}while(1);
Run Code Online (Sandbox Code Playgroud)
编辑:更正缩进和 errno