Article View: borland.public.cppbuilder.internet.socket
Article #4724Re: Windows socket error 10057
From: Remy Lebeau (TeamB)
Date: Thu, 06 Jan 2005 18:08
Date: Thu, 06 Jan 2005 18:08
55 lines
2555 bytes
2555 bytes
"Jeremy" <jeremy@none.com> wrote in message
news:41dd4e96$1@newsgroups.borland.com...
> Whenever I try to send something over my socket, I get
> the following error on the server side:
WSAENOTCONN
(10057)
Socket is not connected.
A request to send or receive data was disallowed because the socket is
not connected and (when sending on a datagram socket using sendto) no
address was supplied. Any other type of operation might also return this
error - for example, setsockopt setting SO_KEEPALIVE if the connection has
been reset.
> On the client side, I get the following error message:
WSAECONNABORTED
(10053)
Software caused connection abort.
An established connection was aborted by the software in your host
machine, possibly due to a data transmission timeout or protocol error.
> I'm fairly certain that the socket is connected since the
> OnConnect events occur for both the client and the server.
The problem is that your sockets are being disconnected abnormally.
> Am I using the ReceiveText function incorrectly?
Yes. See below.
> void __fastcall TForm1::ServerSocket1ClientRead(TObject *Sender,
> TCustomWinSocket *Socket)
> {
> Edit1->Text = Form1->ServerSocket1->Socket
> ->ReceiveText();
> }
That is not correct. You are accessing the wrong socket entirely. The code
should be using the event handler's Socket parameter instead:
void __fastcall TForm1::ServerSocket1ClientRead(TObject *Sender,
TCustomWinSocket *Socket)
{
Edit1->Text = Socket->ReceiveText();
}
Gambit
Technical Details
Message-ID:
<41dd7e48@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41dd4e96$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,13e3a9a3d358153e X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <41dd4e96$1@newsgroups.borland.com> Subject: Re: Windows socket error 10057 Date: Thu, 6 Jan 2005 10:08:38 -0800 Lines: 57 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: 68.69.17.41 Message-ID: <41dd7e48@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1105034824 68.69.17.41 (6 Jan 2005 10:07:04 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail