Thread: Linux programmer needs C networking help...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    200

    Linux programmer needs C networking help...

    Hi there - I'm a Linux programmer, but we're looking at porting a library I wrote over to Win32. Part of it gets the IP address, gateway, netmask and MAC address of the local machine, and is very *nix-specific - how would I go about doing this on C in Windows? I tried a web search but all I could find were articles on using ipconfig from a terminal.

    Also, I've never done any Windows programming before (well, not with C anyway - done a bit of Java stuff) is there any canonical documentation on the web/downloadable for the standard windows API?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Windows uses Winsock2 which is very similar to the Linux Sockets library. Most of the socket calls exchange nicely between platforms, with only minor fixups for variable types and such.

    If you want Windows documentation, go to the source...
    Download details: Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1

    If you are looking for winapi tutorial of some merrit you can try...
    theForger's Win32 API Tutorial

    You can also find a relatively good winsock tutorial here...
    http://johnnie.jerrata.com/winsocktutorial/

    And a little note of caution... Don't even think about comparing Java to C... they are two very different animals. The comparison will only confuse you.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    200
    Quote Originally Posted by CommonTater View Post
    If you want Windows documentation, go to the source...
    Download details: Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1
    Thanks for the link, but I can't see where to get documentation, and the search function on that page doesn't give me what I'm after - if I wanted (for example) to see the documentation for the socket() function from that website, where would I find it? Or the documentation for the winsock.h header?


    Quote Originally Posted by CommonTater View Post
    And a little note of caution... Don't even think about comparing Java to C... they are two very different animals. The comparison will only confuse you.
    Whose confused? I merely meant that my comment about me never having done any Windows programming wasn't entirely true - though in this case, my Java programming experience is almost useless and so may as well just not count.

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    How about this - Winsock Reference (Windows)

    It has all the function details

  5. #5
    Registered User
    Join Date
    Sep 2008
    Posts
    200
    Quote Originally Posted by Fordy View Post
    Perfect - ta very much!

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by JohnGraham View Post
    Thanks for the link, but I can't see where to get documentation, and the search function on that page doesn't give me what I'm after - if I wanted (for example) to see the documentation for the socket() function from that website, where would I find it? Or the documentation for the winsock.h header?
    Download the SDK, install it on a windows system... what you get is a fully indexed reference to all Windows functions and API calls. It's all there... like a windows bible for download.

    The online resource at msdn is also very complete... but you don't get the samples, compilers, window headers and libs the SDK provides.



    Whose confused? I merely meant that my comment about me never having done any Windows programming wasn't entirely true - though in this case, my Java programming experience is almost useless and so may as well just not count.
    Well, not useless in Java... but not much help learning C.
    Last edited by CommonTater; 10-27-2010 at 08:42 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Thinking of upgrading to linux...
    By Yarin in forum General Discussions
    Replies: 37
    Last Post: 07-24-2009, 11:40 AM
  2. Replies: 8
    Last Post: 03-10-2008, 12:08 PM
  3. Some common Linux Questions???
    By code2d in forum Tech Board
    Replies: 4
    Last Post: 12-28-2006, 02:17 AM
  4. Linux Version reccomendation
    By Pobega in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 10-05-2006, 06:48 PM
  5. Linux Linux why Linux??
    By afreedboy in forum Tech Board
    Replies: 146
    Last Post: 01-21-2004, 06:27 PM