# C Socket programming in windows XP



## flame_pvt (Jun 8, 2006)

Hi there,
I wanted to write a simple socket windows program to connect to a site and read a http header and the page with POST and GET Request. This was a easy task in UNIX as gnu library are easily avaiable of that. In windows system, I dont want to buy either VC++ or Borland C++ and these are expensive. I want to use free simple c/c++ complier like Turbo C++, etc. I tried searching for socket libraries for windows, but all of them seems to support either VC++ or Borland complier... Does any one know about a simple c/c++ lib for windows that i can user to make my own program... I dont mind downloanding another C/c++ complier for windows as long its free... I am using windows xp home and currently have turbo c++ 1.0...i know its a very old complier, but works like a gem...

-flame


----------



## Shadow2531 (Apr 30, 2001)

This will help, *some*.

c and c++ compiler (gcc)

(After you install it, create a new shortcut with a target of:

%windir%\system32\cmd.exe /K set "path=c:\mingw\bin;%path%" && cls

and set start in: to

%userprofile%\desktop

(or wherever you work on your files)

Winsock example. (Start at post number 3)

To build something, you do:

gcc -Wall -Wextra file.c -o file
g++ -Wall -Wextra file.cpp -o file

When you do winsock stuff, you need to link to libwsock32.a or libws2_32.lib like this:

gcc -Wall -Wextra file.c -o file -lwsock32


----------



## Genidiot (May 25, 2006)

Visual C++ Express is free (really) from Microsoft if you'd rather use that. I believe it's a stripped down version of Visual C++ .Net 2005.


----------

