?
Solved

Sockets Error (Borland C++ Builder)

Posted on 2002-03-13
1
Medium Priority
?
1,326 Views
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)
0
Comment
Question by:Fearum
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
thienpnguyen earned 400 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
               }
       }


}
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

764 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