Sockets Error (Borland C++ Builder)

Posted on 2002-03-13
Last Modified: 2012-06-21
Asynchronous socket error...

this is what happens if i close the cleint without calling Close ( ) of the client socket... this will bring up a nasty popup in the server which will cause the server to stop working!!!

I NEED TO GET RID of the stupid window, i can write my own error handlers that are much better and dont hang the program (setting the onclienterror does not work)
Question by:Fearum
1 Comment

Accepted Solution

thienpnguyen earned 100 total points
ID: 6862960
1/ For TServerSocket

     Set the ErrorCode parameter to 0 if the OnClientError event
handler successfully deals with the error condition to prevent
an ESocketError from being thrown.

        void __fastcall TForm1::ServerSocket1ClientError(TObject *Sender,
             TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int &ErrorCode)
             if( ErrorCode )
                    // process ...
                    // .....
                    ErrorCode = 0; //  to prevent an ESocketError from being thrown

2/ For TClientSocket

      Write an OnError event handler to respond to errors that arise
with the socket connection. Set the ErrorCode parameter to 0 if the
OnError event handler successfully deals with the error condition,
to prevent an ESocketError from being thrown.

       void __fastcall TForm1::ClientSocket1Error(TObject *Sender,
             TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int &ErrorCode)
              if( ErrorCode )
                     // process ....
                     // ......

                     ErrorCode = 0; //  to prevent an ESocketError from being thrown


Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question