mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 16:20:42 +00:00
A couple of methods added for consistency.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19880 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b6706ad3bc
commit
284ce516b8
4 changed files with 59 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-08-18 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSFileHandle.m: Add methods to get local socket info
|
||||
matching mthe existing methods which return remote address/port.
|
||||
* Source/GSFileHandle.m: ditto.
|
||||
|
||||
2004-08-17 David Ayers <d.ayers@inode.at>
|
||||
|
||||
* Testing/GNUmakefile: Reactivate nsinvocation test.
|
||||
|
|
|
@ -182,6 +182,8 @@ GS_EXPORT NSString * const NSFileHandleOperationException;
|
|||
forModes: (NSArray*)modes;
|
||||
- (BOOL) readInProgress;
|
||||
- (NSString*) socketAddress;
|
||||
- (NSString*) socketLocalAddress;
|
||||
- (NSString*) socketLocalService;
|
||||
- (NSString*) socketService;
|
||||
- (NSString*) socketProtocol;
|
||||
- (BOOL) useCompression;
|
||||
|
|
|
@ -2331,6 +2331,41 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
return address;
|
||||
}
|
||||
|
||||
- (NSString*) socketLocalAddress
|
||||
{
|
||||
NSString *str = nil;
|
||||
struct sockaddr_in sin;
|
||||
int size = sizeof(sin);
|
||||
|
||||
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
str = [NSString stringWithCString: (char*)inet_ntoa(sin.sin_addr)];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
- (NSString*) socketLocalService
|
||||
{
|
||||
NSString *str = nil;
|
||||
struct sockaddr_in sin;
|
||||
int size = sizeof(sin);
|
||||
|
||||
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
str = [NSString stringWithFormat: @"%d",
|
||||
(int)GSSwapBigI16ToHost(sin.sin_port)];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
- (NSString*) socketProtocol
|
||||
{
|
||||
return protocol;
|
||||
|
|
|
@ -613,6 +613,22 @@ NSString * const NSFileHandleOperationException
|
|||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local address of the network connection or nil.
|
||||
*/
|
||||
- (NSString*) socketLocalAddress
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local service/port of the network connection or nil.
|
||||
*/
|
||||
- (NSString*) socketLocalService
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name (or number) of the service (network port) in use for
|
||||
* the network connection represented by the file handle.
|
||||
|
|
Loading…
Reference in a new issue