943,552 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3046
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Dec 5th, 2008
-1

Please help!!! Winsock2/Sockets with C++ Console app?

Expand Post »
Hello. I have been learning C++ for a while now. I know how to create C++ Console applications, and im wondering if theres any good tutorials on using Sockets/Winsock2 in C++ Console apps.

Please don't say I should learn Windows API, or MFC, I already know about those, and I will eventually get to WinAPI. But most of the tutorials I find on the internet either use Visual Basic, or Windows API/MFC with sockets.

If the Beej's sockets tutorial (Uses unix) using the extra windows thing it says in the tutorial will work with C++ Console apps, please tell me... Thanks!

P.S Can you try and tell me about Winsock2 instead of just Winsock, I've heard Winsock2 is better and more advanced.
Last edited by Ancient Dragon; Dec 6th, 2008 at 7:28 am. Reason: removed bold and color tags
Reputation Points: 5
Solved Threads: 0
Light Poster
amerninja2 is offline Offline
36 posts
since Oct 2008
Dec 6th, 2008
0

Re: Please help!!! Winsock2/Sockets with C++ Console app?

Oh gee golly moses. This was the first in the list of google links
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,947 posts
since Aug 2005
Dec 6th, 2008
0

Re: Please help!!! Winsock2/Sockets with C++ Console app?

Oh im sorry about the bold bright text and stuff in my post!! I didn't know about that rule, ill be more carefull next time...

Anyway, thanks ill check that link out!
Reputation Points: 5
Solved Threads: 0
Light Poster
amerninja2 is offline Offline
36 posts
since Oct 2008
Dec 6th, 2008
0

Re: Please help!!! Winsock2/Sockets with C++ Console app?

Well I just looked at that link, and it only shows using sockets with Window API/MFC. Im looking for one that is compatible for using in a C++/C console application, not Windows apps.
Reputation Points: 5
Solved Threads: 0
Light Poster
amerninja2 is offline Offline
36 posts
since Oct 2008
Dec 6th, 2008
0

Re: Please help!!! Winsock2/Sockets with C++ Console app?

You can still use the windows API in your console application. There is no standard sockets implementation. So you need to use API calls, be it Win32 or POSIX.

Chris
Last edited by Freaky_Chris; Dec 6th, 2008 at 3:12 pm.
Reputation Points: 325
Solved Threads: 118
Master Poster
Freaky_Chris is offline Offline
702 posts
since Apr 2008
Dec 6th, 2008
0

Re: Please help!!! Winsock2/Sockets with C++ Console app?

No Windows API is different. Console applications are the DOS window.
Last edited by amerninja2; Dec 6th, 2008 at 3:15 pm.
Reputation Points: 5
Solved Threads: 0
Light Poster
amerninja2 is offline Offline
36 posts
since Oct 2008
Dec 6th, 2008
0

Re: Please help!!! Winsock2/Sockets with C++ Console app?

winsock IS part of win32 api. If you are looking for more complex client/server console code then you can find it by downloading the library here

>>No Windows API is different. Console applications are the DOS window.
You don't have to write a windows program to implement some win32 api functions.
Last edited by Ancient Dragon; Dec 6th, 2008 at 3:23 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,947 posts
since Aug 2005
Dec 6th, 2008
0

Re: Please help!!! Winsock2/Sockets with C++ Console app?

What about Unix Sockets. It says to run on Windows theres things in it that you have to change/add, but will a C++ DOS Console app run normal unix sockets under windows normally without the changes?
Reputation Points: 5
Solved Threads: 0
Light Poster
amerninja2 is offline Offline
36 posts
since Oct 2008
Dec 6th, 2008
0

Re: Please help!!! Winsock2/Sockets with C++ Console app?

Oh, so can I use the Console lib under a windows app, and then use sockets with that? Or is my other comment I just replyed with true?
Reputation Points: 5
Solved Threads: 0
Light Poster
amerninja2 is offline Offline
36 posts
since Oct 2008
Dec 6th, 2008
0

Re: Please help!!! Winsock2/Sockets with C++ Console app?

DOS != UNIX therefore they are different. Therefor they need different sockets. *Win*sock is the windows socket libraries, implemented with Win32 API calls, which CAn be used with DOS console applications but NOT unix.

Chris
Reputation Points: 325
Solved Threads: 118
Master Poster
Freaky_Chris is offline Offline
702 posts
since Apr 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Please Help: getting a runtime error
Next Thread in C++ Forum Timeline: pleeeze help me I have been tired:(





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC