永
永不言败
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大虾,我的程序在用socket传送数据时总出现乱码,请帮忙:
1) 客户端用delphi写传送数据的程序,阻塞方式
2) 服务器端用java写接受数据的程序,阻塞方式
请帮忙分析出现问题的可能性.
注:
1)当客户端用非阻塞方式(delphi写),服务器端不作任何改动,就OK
2)客户端的程序如下:
procedure TmyclientThread.Execute;
var
Wstream:twinsocketstream;
bufferwidechar;
isend:integer;
begin
Wstream:=twinsocketstream.Create(form1.clientsocket1.socket,2000);
try
if (not terminated) and (form1.ClientSocket1.active) then
begin
try
buffer:='END'+#0;
isend:=length(buffer)+1;
Wstream.Write(buffer,isend);
.....
except
if not(Exceptobject is Eabort) then ...
end;
end;
finally
Wstream.free;
end;
end;
1) 客户端用delphi写传送数据的程序,阻塞方式
2) 服务器端用java写接受数据的程序,阻塞方式
请帮忙分析出现问题的可能性.
注:
1)当客户端用非阻塞方式(delphi写),服务器端不作任何改动,就OK
2)客户端的程序如下:
procedure TmyclientThread.Execute;
var
Wstream:twinsocketstream;
bufferwidechar;
isend:integer;
begin
Wstream:=twinsocketstream.Create(form1.clientsocket1.socket,2000);
try
if (not terminated) and (form1.ClientSocket1.active) then
begin
try
buffer:='END'+#0;
isend:=length(buffer)+1;
Wstream.Write(buffer,isend);
.....
except
if not(Exceptobject is Eabort) then ...
end;
end;
finally
Wstream.free;
end;
end;