Socket programming compile error

Hello all!
I have some C code,as introduced ,it can be compiled in both Windows and Unix.But when i compile in Windows ,it compile fail because of its use "#include sys/socket.h" which is not of Windows socket programming API.The Complete include section is like :
#include <stdio.h>
#include <stdlib.h>
#include <error.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <netdb.h>
#include <fcntl.h>
#include <unistd.h>
What library should I install to compile(and link,of course) this code snippet?
Thanks in advance
Who is Participating?
sunnycoderConnect With a Mentor Commented:
errors are due the linux specific functions that you may be using ... post the errors here ...

winsock.h is the file to use if you want to port it to windows ... If all you want is to be able to compile it on windows then download cygwin platform
Hi Lara_tin2,

use #include <winsock.h>

Lara_tin2Author Commented:
ok!I've tried it but very many error occur when I compile.
I want a header file sys/socket.h and coresponding lib file but dont know where to download it
Lara_tin2Author Commented:
Thanks!I will try it
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.