Hello Persian, > Please help me to fix this problem .
You dont tell what the problem is ! Some quick view: > myData.LoadFromFile(OpenPictureDialog1.FileName); > myData.Position:=0; > Size := WSocket1.Send(myData.Memory,myData.Size); You send a picture in 1 packet UDP ? Or do you use TCP ? Or are the pictures very small (less than +- 1500 bytes ?). > Data : array [0..1023] of Pointer; I think you want array of byte or array of char here. a pointer is 4 byte. > if Len >= 0 then begin You dont process if Len == 0, only if Len > 0. > Stream.Write(Data, Len); > Stream.Position:=0; > myImage:=TJPEGImage.Create; Same remark as with send. Do you use UDP and all data in 1 package ? Then this could work, with TCP: No, and with UDP if you use several packages: No. So please explain what you try to do and witch proto you use because this is a little confusing now. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Wednesday, January 11, 2006, 09:06, Persian Patient wrote: > 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 well 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