Solved

Sockets Error (Borland C++ Builder)

Posted on 2002-03-13
1
1,248 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
1 Comment
 
LVL 6

Accepted Solution

by:
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
               }
       }


}
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 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…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now