Reputation: 1
I'm trying to convert a c program into c++ program . what is the equivalent header file for socket.h in c++ ?
Upvotes: 0
Views: 1630
Reputation: 490808
There's no real need to change the headers at all. On the other hand, if you're just planning to use the existing code, I'd probably just add:
#ifdef __cplusplus
#extern "C" {
#endif
and
#ifdef __cplusplus
}
#endif
...to a header for your existing code, and leave it as C instead of re-compiling as C++.
If you're developing new code in C++, I'd consider using something like POCO, ACE, or Boost::ASIO instead of writing directly to the sockets API.
Upvotes: 0