Dear Friends ,
  Hello , I have found a sample of ICS in component package , this sample can 
send a text message , I was made some changes on that to send an image over the 
network .
  my final code is as the follows :
   
  OnDataAvailable event on receiver side :
  -------------------------------------------------------
  var
    Data     : array [0..1023] of Pointer;
    Len      : Integer;
    Src      : TSockAddrIn;
    SrcLen   : Integer;
    Stream   : TMemoryStream;
    Size     : Integer;
    myImage  : TJpegImage;
begin
    Stream:=TMemoryStream.Create;
    SrcLen := SizeOf(Src);
    Len    := WSocket1.ReceiveFrom(@Data, SizeOf(Data), Src, SrcLen);
    if Len >= 0 then begin
      Data[Len] := 0;
      Size := Sizeof(Data);
      Stream.Write(Data, Len);
      Stream.Position:=0;
      myImage:=TJPEGImage.Create;
      myImage.LoadFromStream(Stream);
      Image1.Picture.Graphic:=myImage;
      memo1.lines.add(inttostr(Stream.Size));
      end;
   
  SendButton of Sender Side :
  -------------------------------------
   
  var
  myData : TMemoryStream;
  Size : Integer;
begin
OpenPictureDialog1.Execute;
if OpenPictureDialog1.FileName<>'' then begin
myData:=TMemoryStream.Create;
myData.LoadFromFile(OpenPictureDialog1.FileName);
myData.Position:=0;
Size := WSocket1.Send(myData.Memory,myData.Size);
memo1.Lines.add(inttostr(size));
end;

  Please help me to fix this problem .
  Best Regards,
  Persian Patient.



                
---------------------------------
Yahoo! Photos – Showcase holiday pictures in hardcover
 Photo Books. You design it and we’ll bind it!
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to