Solved

Sockets Error (Borland C++ Builder)

Posted on 2002-03-13
1
1,236 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

746 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

12 Experts available now in Live!

Get 1:1 Help Now