Q&A

  • 스트림 송/수신
########## 클라이언트 'ttt1.bmp'를 서버로 보내려고 합니다.



procedure TForm1.Button1Click(Sender: TObject);

var

MyFStream : TFileStream;

begin

NMStrm1.Host := '202.31.137.244';

NMStrm1.Port := 6011;

NMStrm1.FromName := 'num1';

MyFStream := TFileStream.Create('F:ttt1.bmp', fmopenread);

try

NMStrm1.PostIt(MyFStream);

finally

MyFStream.Free;

end;

end;



########## 서버측 코드



procedure TForm1.NMStrmServ1MSG(Sender: TComponent; const sFrom: String;

strm: TStream);

var

MyFStream : TFileStream;

begin

if fileexists('F:tmp.bmp') then deletefile('F:tmp.bmp');

MyFStream := TFileStream.Create('F:tmp.bmp', fmCreate);

try

MyFStream.CopyFrom(strm, strm.size);

finally

MyFStream.Free;

end;

image1.Picture.LoadFromFile('F:tmp.bmp');

end;



procedure TForm1.NMStrmServ1ClientContact(Sender: TObject);

begin

NMStrmServ1.ReportLevel := Status_Basic;

NMStrmServ1.TimeOut := 90000;

end;



클라이언트에서 cannot file open 'ttt1.bmp'에러가 납니다.

버튼 한번은
0  COMMENTS