Link to home
Start Free TrialLog in
Avatar of ryan_sabarre
ryan_sabarre

asked on

ServerSocket Error

what causes the Error when i have my own ServerSocket running and a computer connecting with my computer (using
clientSocket) and when i close the program(the one connected with my computer) with Ctrl+alt+del / end task.
well, in my computer it would receive a socket error. how
can i prevent it? and can you teach me a good way of
programming Client and ServerSocket component...



Avatar of Epsylon
Epsylon

Write an OnClientError event handler like this:


procedure TForm1.ServerSocket1ClientError(Sender: TObject;
  Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
  var ErrorCode: Integer);
begin
  InputMemo.Lines.Add('Error occured: ' + IntToStr(ErrorCode));
  case ErrorEvent of
    eeGeneral:    InputMemo.Lines.Add('General error');
    eeSend:       InputMemo.Lines.Add('Send error');
    eeReceive:    InputMemo.Lines.Add('Receive error');
    eeConnect:    InputMemo.Lines.Add('Connect error');
    eeDisconnect: InputMemo.Lines.Add('Disconnect error');
    eeAccept:     InputMemo.Lines.Add('Accept error');
  end;
  ErrorCode := 0;
end;


Cheers,

Epsylon.
ASKER CERTIFIED SOLUTION
Avatar of Epsylon
Epsylon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Epsylon: I would like a copy of the demo, if you don't mind. Using Delphi 4.

pe@des.dk

/Pede


Pede, I send as soon as Ryan responds....
ryan_sabarre, are you going to do something?
Hello?
GREETINGS!

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange