Re: How to use sys/socket.h functions in windows OS.
- From: Kenneth Brody <kenbrody@xxxxxxxxxxx>
- Date: Mon, 04 Dec 2006 09:59:22 -0500
Ravikumar wrote:
[...]
Hi All,
The following code snippet is a part of s/w which is downloaded from
net. While compiling this code I got the following error.
..\..\snmplib\snmpTCPDomain.c(6) : fatal error C1083: Cannot open
include file: 'sys/socket.h': No such file or directory
Socket programming (which is OT for clc anyway) is different for
Windows than it is for *nix systems. For Windows, you will need
to read up on "winsock" routines. Many things match up in winsock
to "normal" sockets, but there are many differences as well.
You'll need to ask one of the Windows programming groups for more
specifics. I'm not sure which one would be appropriate.
Here is a (very-OT) sample of the start of a module which accesses
sockets on both Windows and *nix. Take it to an appropriate winsock
group for any questions you may have.
==========
#if DOS_NT
#include <winsock.h>
#define SocketErrno (WSAGetLastError())
#define bcopy(src,dest,len) memmove(dest,src,len)
#else
#include <sys/socket.h>
#include <sys/poll.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/select.h>
#define SocketErrno errno
#define SOCKET int
#define SOCKET_ERROR -1
#define INVALID_SOCKET -1
#endif
==========
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:ThisIsASpamTrap@xxxxxxxxx>
.
- References:
- How to use sys/socket.h functions in windows OS.
- From: Ravikumar
- How to use sys/socket.h functions in windows OS.
- Prev by Date: Re: How to use sys/socket.h functions in windows OS.
- Next by Date: Re: Unwanted rounding
- Previous by thread: Re: How to use sys/socket.h functions in windows OS.
- Next by thread: Re: How to use sys/socket.h functions in windows OS.
- Index(es):
Relevant Pages
|