| | Submitted on: 8/18/2003 11:01:49 AM
By: Adrian Cristea
Level: Beginner User Rating: Unrated Compatibility:Delphi 7, Delphi 6, Delphi 5
Users have accessed this article 1443 times. | |
| | I want to know how to control an error from TClientSocket! I set socketerror to 0 (zero) but when my program does a reconection: Windows socket error on api connect (10049)! How can I control it? Please help me... | |
|
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description. | Hello world!
I need your help again... I am a beginner...
K... My problem is that of using sockets. I made a program that
use sockets (TClientSocket) in Delphi7. It worket very fine on
localhost(disconnected from the net)! Client.host:='localhost';
Client.port:='1034'; SocketError:=0 (no errors!); I set this: on error reconnect and on disconnect
reconect again and on load form connect! It worket fine!
But when I set client.host to 'www.yahoo.com' or another server
errors apears on display (notice that socketerror:=0)! Why?
Error: Windows socket error (10049) on api connect! How can
I control this errors?
Please tell me how to control this... I need it... Thanks! | |
Other 3 submission(s) by this author
|
|
|
Report Bad Submission |
|
|
Your Vote! |
See Voting Log |
|
Other User Comments |
8/18/2003 2:15:13 PM:Aseerha I didnt really get you, but I'll try my
best. If you want to handle that error,
type:
try
client.blabblbla;
client.an
otherblabla;
except
showmessage
('This error occured');
end;
This
will raise a messagebox when an error
occurs... :) Delphi7's debugger might
stop the execution, but if compile it
and run it, it will handle the error..
:)
|
8/18/2003 6:27:44 PM: I know what your talking about I
sometime have the same issue, & usually
even a TRY EXCEPT statement wont work,
it would be possible to make a custom
exception hidden dialog/log to handle
any exceptions
This is what i used for
one of my projects, may be of help or
not ;) -
Case ErrorCode of
10049:
ClientSocket1.Open;
11004:
Log('Server Not Found, Check
Connection');
10022: Log('Sync Cancel
Request');
Else
Log('Error ' +
IntToStr(ErrorCode));
End;
Errorcode
:= 0;
|
8/19/2003 12:43:42 AM: Thanks man... My project works fine
right now! Thanks again...
|
9/22/2003 4:55:21 AM: I've a further question, maybe it looks
foolish-): Where I should put the" Case
ErrorCode of 10049: ClientSocket1.Open;
11004: Log('Server Not Found, Check
Connection'); 10022: Log('Sync Cancel
Request'); Else Log('Error ' +
IntToStr(ErrorCode)); End; Errorcode :=
0;"
|
|
Add Your Feedback! |
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here. |
|