Article View: borland.public.cppbuilder.internet.socket
Article #4006Re: Socket problem setting port and connecting.
From: Egi2kaZz
Date: Tue, 26 Apr 2005 13:50
Date: Tue, 26 Apr 2005 13:50
75 lines
3189 bytes
3189 bytes
thanx, that codes works fine, but every time y receive file, I have
to do :
try {
ReadStream(Socket, file);
}
__finally {
delete file;
ClientSocket1->Active=false;
Memo1->Lines->Add("file received");
ClientSocket1->Active=true;
}
if I don't inactive ClientSocket my progmam fails :(
void __fastcall TForm1::ServerSocket1ClientConnect(TObject *Sender,
TCustomWinSocket *Socket)
{
Memo1->Lines->Add("client connected");
}
void __fastcall TForm1::ServerSocket1ClientDisconnect(TObject *Sender,
TCustomWinSocket *Socket)
{
Memo1->Lines->Add("client disconnected");
}
and every time then I send file, My client has to disconnect and then
connect again?
One more thing, then I'm sending files, chating and etc. over Client/Server
Socket's that protocol I am using?
thanx 4 answers
e.
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:426bf467$1@newsgroups.borland.com...
>
> "Egi2kaZz" <egi2kas@gmail.com> wrote in message
> news:426abd97@newsgroups.borland.com...
>
>> how and where to specify port and address in client and server pc?
>
> TClientSocket has Address/Host and Port properties. You can set them any
> time prior to connecting to the server.
>
> TServerSocket has a Port property. You can set it any time prior to
> activating the server.
>
>> i'm getting 10049 10061 erros :(
>
> WSAEADDRNOTAVAIL (10049)
>
> Cannot assign requested address.
>
> The requested address is not valid in its context. Normally results
> from
> an attempt to bind to an address that is not valid for the local machine,
> or
> connect/sendto an address or port that is not valid for a remote machine
> (e.g. port 0).
>
>
> WSAECONNREFUSED (10061)
>
> Connection refused.
>
> No connection could be made because the target machine actively refused
> it. This usually results from trying to connect to a service that is
> inactive on the foreign host - i.e. one with no server application
> running.
>
>
> Gambit
>
>
Technical Details
Message-ID:
<426e472d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsread.com!newsprint.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42638bd3$1@newsgroups.borland.com> <4263a52c@newsgroups.borland.com> <426abd97@newsgroups.borland.com> <426bf467$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,87ef1514521c3f8d X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Egi2kaZz" <egi2kas@gmail.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <42638bd3$1@newsgroups.borland.com> <4263a52c@newsgroups.borland.com> <426abd97@newsgroups.borland.com> <426bf467$1@newsgroups.borland.com> Subject: Re: Socket problem setting port and connecting. Date: Tue, 26 Apr 2005 16:50:43 +0300 Lines: 77 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 193.219.160.135 Message-ID: <426e472d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1114523437 193.219.160.135 (26 Apr 2005 06:50:37 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsread.com!newsprint.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail