329 |
"Return a list of three elements: the address, the hostname and the port for the other end of the socket. If hostname is not available it will be equal to the address. Invalid on server sockets. Return NIL on failure.") |
"Return a list of three elements: the address, the hostname and the port for the other end of the socket. If hostname is not available it will be equal to the address. Invalid on server sockets. Return NIL on failure.") |
330 |
{ |
{ |
331 |
struct sockaddr_in peername; |
struct sockaddr_in peername; |
332 |
int size = sizeof(struct sockaddr_in); |
unsigned size = sizeof(struct sockaddr_in); |
333 |
struct hostent *hostEntPtr; |
struct hostent *hostEntPtr; |
334 |
object address,host; |
object address,host; |
335 |
check_socket(sock); |
check_socket(sock); |
351 |
DEFUN_NEW("GETSOCKNAME",object,fSgetsockname,SI,1,1,NONE,OO,OO,OO,OO,(object sock), |
DEFUN_NEW("GETSOCKNAME",object,fSgetsockname,SI,1,1,NONE,OO,OO,OO,OO,(object sock), |
352 |
"Return a list of three elements: the address, the hostname and the port for the socket. If hostname is not available it will be equal to the address. Return NIL on failure. ") |
"Return a list of three elements: the address, the hostname and the port for the socket. If hostname is not available it will be equal to the address. Return NIL on failure. ") |
353 |
{ struct sockaddr_in sockname; |
{ struct sockaddr_in sockname; |
354 |
int size = sizeof(struct sockaddr_in); |
unsigned size = sizeof(struct sockaddr_in); |
355 |
struct hostent *hostEntPtr; |
struct hostent *hostEntPtr; |
356 |
object address,host; |
object address,host; |
357 |
|
|
635 |
if (high > 0) |
if (high > 0) |
636 |
{ object bufp = SOCKET_STREAM_BUFFER(strm); |
{ object bufp = SOCKET_STREAM_BUFFER(strm); |
637 |
int n; |
int n; |
638 |
n = SAFE_READ(fd,bufp->ust.ust_self ,bufp->ust.ust_dim); |
n = SAFE_READ(fd,bufp->st.st_self ,bufp->ust.ust_dim); |
639 |
doReverse(bufp->ust.ust_self,n); |
doReverse(bufp->st.st_self,n); |
640 |
bufp->ust.ust_fillp=n; |
bufp->ust.ust_fillp=n; |
641 |
if (n > 0) |
if (n > 0) |
642 |
{ |
{ |