Bitcoin Forum
May 26, 2024, 07:59:38 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: socket libraries for bitcoin windows/osx  (Read 608 times)
clarity510 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
February 08, 2016, 04:16:16 PM
 #1

Hey,

What socket libraries does bitcoin use?

I found this in netbase.cpp:
#ifndef WIN32
#if HAVE_INET_PTON
#include <arpa/inet.h>
#endif
#include <fcntl.h>
#endif

Does that mean for OS X they use arpa/inet.h and for windows it's fcntl.h?

Do those two libraries use the same functions?

Thanks,
Ryan Ragle
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3402
Merit: 6657


Just writing some code


View Profile WWW
February 08, 2016, 09:56:23 PM
 #2

Hey,

What socket libraries does bitcoin use?

I found this in netbase.cpp:
#ifndef WIN32
#if HAVE_INET_PTON
#include <arpa/inet.h>
#endif
#include <fcntl.h>
#endif

Does that mean for OS X they use arpa/inet.h and for windows it's fcntl.h?

Do those two libraries use the same functions?

Thanks,
Ryan Ragle
This means that if WIN32 has not yet been defined, then if HAVE_INET_PTON is true, then it will include arpa/inet.h and fcntl.h, otherwise it will include just fcntl.h. These include apply to windows only because the condition surrounding the whole thing is checking for windows.

I'm assuming the two libraries are used because one is better than the other, but it doesn't exist on all systems. Later in the code you can see conditions for HAVE_INET_PTON which only compiles if that is true.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!