?
Solved

How Winsock API Can be Used with Win32 API? - C C++ under Windows

Posted on 2008-11-18
3
Medium Priority
?
1,066 Views
Last Modified: 2013-11-13
As far as i know, to make network applications under windows you need to use Winsock API. What if i want to do network programming with Win32 API, what should i do?

1. Do i have to use Winsock API inside my Win32 API?

2. Doesn't Win32 API has  its own ways to handle sockets?

3. I used some Winsock API when i programmed in consoles. However, Winsock API
can create network application within Command Interface. I did not see any facility that makes
Winsock API can be programmed or handled through GUI! So is Win32 API has another set of libraries for sockets that handle sockets &  take the role of Winsock API?

4. If yes, then Winsock API is only good for non GUI application! Thats how i understand it, can you clarify please if i'm wrong

5. Winsock API comes beneath Win32 API, so Win32 is basic API for windows.  Right?

6. What other API's resides Windows other than Winsock? (Ignore DOS API)

7. Win32 API is written in C. Other windows API's (Winsock) are written in what language?

8. Is Winsock API written with Win32 API? As far as i know, Win32 API is the mother of any API resides in Windows OS. Any API in Win OS needs to be written with Win32 API! Right?

I hope my questions are clear. Please answer it in an easy fashion, if you don't mind!
I'm trying to understand what Win32 API before i start learning it. Thus, alot of why's pop up in my mind....

Thanks in Advance
0
Comment
Question by:F-J-K
  • 2
3 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 22983723
The Winsock library and the Win32 API are two different things - they can be used together. The Winsock library provides functionality for socket programming. The Win32 API is simply an interface to several system provided functions.

The Winsock library can be used in any kind of Windows application, whether it's a console application, it uses a GUI, or ... There's nothing in the Winsock library that would interfere.
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 2000 total points
ID: 22983787
Or question by question :

>> 1. Do i have to use Winsock API inside my Win32 API?

Using an API inside an API does not make sense. API's are simply interfaces (it literally means Application Programming Interface). You can make use of several API's at the same time if you want.


>> 2. Doesn't Win32 API has  its own ways to handle sockets?

The Win32 API (or more correctly the Windows API) is the superset of all standard API's provided by the Windows operating system. Note that the Winsock API is a (small) part of the Windows API. So, yes the Windows API has ways of handling sockets.


>> 3. I used some Winsock API when i programmed in consoles. However, Winsock API can create network application within Command Interface. I did not see any facility that makes Winsock API can be programmed or handled through GUI! So is Win32 API has another set of libraries for sockets that handle sockets &  take the role of Winsock API?

The Winsock library does not impose any limitations on whether the application has to be a console application or not. They're two different concepts (network programming versus presentation - they're generally on two opposite "ends" of the application).


>> 4. If yes, then Winsock API is only good for non GUI application! Thats how i understand it, can you clarify please if i'm wrong

Yes, you are wrong. The Winsock API can be used in both console and GUI applications.


>> 5. Winsock API comes beneath Win32 API, so Win32 is basic API for windows.  Right?

The Windows API is a collection of all the core API's provided by the Windows operating system. The Winsock API is a (small) part of that.


>> 6. What other API's resides Windows other than Winsock? (Ignore DOS API)

A lot ;) Here's a nice overview :

        http://en.wikipedia.org/wiki/Windows_API


>> 7. Win32 API is written in C. Other windows API's (Winsock) are written in what language?

I don't know for sure whether it's written in C - it seems like a logical guess though. In the end, it doesn't really matter how these API's are implemented. All that matters is how you can make use of the functionality, and that's exactly what an API describes : how to make use of the functionality provided by it.
Note that the Windows API can be used in a wide range of languages, including C, C++, C#, VB, etc.


>> 8. Is Winsock API written with Win32 API? As far as i know, Win32 API is the mother of any API resides in Windows OS. Any API in Win OS needs to be written with Win32 API! Right?

Any application that wants to make use of functionality provided by the Windows OS should make use of the Windows API.
0
 
LVL 1

Author Closing Comment

by:F-J-K
ID: 31517810
Clear enough. Well answered!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question