mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
improve error checking and reporting when making a tcp/ip connection.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24168 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fa13ef9c99
commit
b8209430fd
5 changed files with 45 additions and 8 deletions
|
@ -2024,17 +2024,27 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (operation == GSFileHandleConnectCompletionNotification
|
||||
|| operation == GSSOCKSConnect)
|
||||
{ // Connection attempt completed.
|
||||
extern int errno;
|
||||
int result;
|
||||
int rval;
|
||||
unsigned len = sizeof(result);
|
||||
|
||||
if (getsockopt(descriptor, SOL_SOCKET, SO_ERROR,
|
||||
(char*)&result, &len) == 0 && result != 0)
|
||||
rval = getsockopt(descriptor, SOL_SOCKET, SO_ERROR, (char*)&result, &len);
|
||||
if (rval != 0)
|
||||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Connect attempt failed - %@",
|
||||
[NSError _last]];
|
||||
[info setObject: s forKey: GSFileHandleNotificationError];
|
||||
}
|
||||
else if (result != 0)
|
||||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Connect attempt failed - %@",
|
||||
result, [NSError _systemError: result]];
|
||||
[info setObject: s forKey: GSFileHandleNotificationError];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue