Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
513 B

22 years ago
#include <sys/types.h>
#include <sys/param.h>
#ifndef __MINGW32__
22 years ago
#include <sys/socket.h>
#include <netinet/in.h>
#include "windoze.h"
22 years ago
#include "byte.h"
#include "socket.h"
#include "havesl.h"
22 years ago
int socket_local4(int s,char ip[4],uint16 *port)
struct sockaddr_in si;
socklen_t len = sizeof si;
22 years ago
if (getsockname(s,(struct sockaddr *) &si,&len) == -1) return winsock2errno(-1);
if (ip) *(uint32*)ip = *(uint32*)&si.sin_addr;
if (port) uint16_unpack_big((char *) &si.sin_port,port);
22 years ago
return 0;