libowfat/socket/socket_connected.c

18 lines
303 B
C
Raw Normal View History

2001-10-15 14:34:02 +00:00
#include <sys/types.h>
2001-02-05 17:50:19 +00:00
#include <sys/socket.h>
#include <netinet/in.h>
#include "socket.h"
2001-11-24 19:37:35 +00:00
#include "havesl.h"
2001-02-05 17:50:19 +00:00
int socket_connected(int s) {
struct sockaddr si;
2001-11-24 19:37:35 +00:00
#ifdef HAVE_SOCKLEN_T
2001-02-05 17:50:19 +00:00
socklen_t sl=sizeof si;
2001-11-24 19:37:35 +00:00
#else
int sl=sizeof si;
#endif
2001-02-05 17:50:19 +00:00
if (getpeername(s,&si,&sl))
return 0;
return 1;
}