-
October 28th, 2018, 06:54 PM
#1
Is there any library that abstracts Winsock and Posix socket implementation?
So, I know that socket programming depends on OS system calls but from my knowledge about operating systems (as a colleague) I know that when you are dealing with sockets you actually need 4 system calls, read(), write(), bind() and listen(). So Is there any good library that does some abstraction for these system calls and based on the OS you are running the program it initialize these functions with the system calls of that OS?
I found this but if I'm correct what it basically tells you is that you have to implement both windows sockets and Posix sockets and control which code you compile using pre-processor statements.
I don't want to do that every time, so I'm wondering if there is a good library out there that is abstracting that for me. I searched a lot of times and I can't find any...
Also I want it to be c compatible too not only c++.
Thank you
-
October 29th, 2018, 05:28 AM
#2
Re: Is there any library that abstracts Winsock and Posix socket implementation?
Originally Posted by babaliaris
So, I know that socket programming depends on OS system calls but from my knowledge about operating systems (as a colleague) I know that when you are dealing with sockets you actually need 4 system calls, read(), write(), bind() and listen().
It is only for server socket. And there is also accept()...
Victor Nijegorodov
-
March 27th, 2019, 03:03 AM
#3
Re: Is there any library that abstracts Winsock and Posix socket implementation?
I can also suggest the plibsys library: works on both Windows and UNIX systems (see the full list on the project page) with various compilers. Supports IPv4 and IPv6. It has the tests where you can see the usage examples. The library itself is lightweight and portable.
-
July 26th, 2019, 05:43 AM
#4
Re: Is there any library that abstracts Winsock and Posix socket implementation?
Note: The following examples have been tested using Code::Blocks and GCC on Windows XP (x86) and Debian Testing (AMD64).
???
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|