我有一个使用TTCPServer部件在Delphi书写的简单服务器,它有一个真正基本的OnAccept事件程序,如下文......。
“10000”
procedure TMainWindow.TcpServerAccept(Sender: TObject;
ClientSocket: TCustomIpClient);
var
S: String;
begin
S := ClientSocket.Receiveln();
ShowMessage(S);
ShowMessage(IntToStr(Length(S)));
Memo1.Lines.Add(S);
end;
简便的“加拿大”一页。
<?php
$address = 127.0.0.1 ;
$port = 10000;
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($sock, $address, $port);
socket_set_option($sock, SOL_SOCKET, SO_KEEPALIVE, 1);
$msg = Hello...! ;
echo socket_write($sock, $msg, strlen($msg));
socket_close($sock);
?>
Now the problem is when I m trying to write into the connected socket with php page no error occurred but the received text in the Delphi application (listener) show me the wrong result some thing like this "效汬⸮!"
what should I do ???