🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #4640

please help me..socket file transfer

#4640
From: billaras
Date: Tue, 11 Jan 2005 11:24
35 lines
2230 bytes
i want when i click the button to send the file from a serversocket to a
client socket
 please help me
what is wrong with the code?is it better to use indy components?if yes could
y plz sypply me with the code?
any ideas would be most welcome..always using borland builder(only)
THANK YOU ALL IN ADVANCE FOR YOUR HELP

void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (OpenDialog1->Execute())
{
TFileStream* file = new TFileStream(OpenDialog1->FileName,fmOpenRead);
ServerSocket1->Socket->Connections[0]->SendStream(file);
Memo1->Lines->Add(file->Size);
}}
//--------------------------------------------------------------------------
-

void __fastcall TForm1::ClientSocket1Read(TObject *Sender,
      TCustomWinSocket *Socket)
{
int iLen;
Pointer BFR;
iLen=ClientSocket1->Socket->ReceiveLength();
Memo2->Lines->Add(iLen);
//GetMem(BFR,iLen);
ClientSocket1->Socket->ReceiveBuf(BFR,iLen);
SaveDialog1->Execute();
TFileStream *file2 = new TFileStream(SaveDialog1->FileName,fmOpenWrite);
file2->ReadBuffer(BFR,iLen);
file2->Write(BFR,iLen);
}
//------------------------------------------------------------------------
of course it doesnt work..lol..please help me
Technical Details
Message-ID: <41e3b756@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,399582d307fda7fe,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "billaras" <billaras1234@hotmail.com>
From: "billaras" <billaras1234@hotmail.com>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: please help me..socket file transfer
Date: Tue, 11 Jan 2005 13:24:09 +0200
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 195.251.45.43
Message-ID: <41e3b756@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1105442646 195.251.45.43 (11 Jan 2005 03:24:06 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail