Good evening. I want to initialize a socket in C ++ (GNU GCC Compiler) (on Mac OS X Lion) without using third-party libraries. When I try to find information in Google, basically I’m offered a solution to a problem on WinSock. Tell me, is it possible to initialize sockets without connecting libraries, independently. I would like to receive a detailed answer or a link to an article devoted to this issue.

    4 answers 4

    I do not understand the complexity. The fact is that in any * nix-system all functions of working with sockets are present. And as if they do not require any left libraries. Because everything is already included out of the box. See this example and here .

      man 2 socket man 2 connect man 2 write man 2 read man 2 setsockopt man 2 getsockopt man 2 bind man 2 listen man 2 accept man 2 close man 2 shutdown man 2 ioctl man 2 fcntl man 2 dup man 2 errno man 3 perror man 3 strerror 

      I propose to slowly light a pack of Orthodox (kosher) manov through the built-in terminal emulator and thus achieve enlightenment ( smoke ).

      • five
        Humor appreciated :-) - gecube
      • one
        Short version of the answer: RTFM - igumnov
      • Something I can not understand is thick, or thin :) - AlexDenisov

      As far as I understand, low-level socket programming for macos is POSIX compliant. In this case, it is described in almost any book on Unix / Linux programming, in varying degrees of detail. As the most detailed manual, we can recommend the classic book Stevens "Unix. Development of network applications". And so - the mass of material in the network and other books.

      And further. If you really want to give up any dependency, even on glibc, you can write in assembler, making system calls using special interrupt instructions. But this is a separate topic.

        Here is a pdf-file, I see it for the first time, but I think that there is something useful there.

        And there is a lot of useful.