Clan x86

Technical (Development, Security, etc.) => General Programming => Topic started by: Joe on October 11, 2005, 07:00:11 PM

Title: [C++] Beginning socket use
Post by: Joe on October 11, 2005, 07:00:11 PM
Yeah. Anyone know any good tutorials?

g++, linux 2.6
Title: Re: [C++] Beginning socket use
Post by: drka on October 11, 2005, 07:49:49 PM
if you're on windows, MFC

if not, then i dunno. if you have winsock.h or winsock2.h with it, then i think you can. but then again i dont have Linux cause i dont know how to clear a hard drive.
Title: Re: [C++] Beginning socket use
Post by: MyndFyre on October 11, 2005, 08:12:36 PM
wxWidgets (http://www.wxwidgets.org) provides an open-source, cross-platform library that includes socket support.  The base class is wxSocketBase (http://www.wxwindows.org/manuals/2.4.2/wx346.htm#wxsocketbase) which has derived classes.
Title: Re: [C++] Beginning socket use
Post by: Joe on October 11, 2005, 08:58:32 PM
Quotelinux 2.6
Quoteif you're on windows, MFC
READ =)
[/size]

I'll give that a look Myndfyre
Title: Re: [C++] Beginning socket use
Post by: MyndFyre on October 11, 2005, 09:53:46 PM
Looks like it has event support to, via the Notify, SetNotify, and Callback functions.  :)
Title: Re: [C++] Beginning socket use
Post by: drka on October 11, 2005, 10:13:57 PM
Quote from: Joe[e2] on October 11, 2005, 08:58:32 PM
Quotelinux 2.6
Quoteif you're on windows, MFC
READ =)
[/size]

I'll give that a look Myndfyre
you and your gayness. MFC is still a good library
Title: Re: [C++] Beginning socket use
Post by: Newby on October 11, 2005, 10:50:11 PM
Quote from: Mangix on October 11, 2005, 10:13:57 PM
MFC is still a good library

But, as he stated, he cannot use it in Linux. :P
Title: Re: [C++] Beginning socket use
Post by: Joe on October 12, 2005, 08:05:44 AM
MFC is, in my eyes, the CSB of the entire C++ language.
Title: Re: [C++] Beginning socket use
Post by: MyndFyre on October 12, 2005, 11:51:33 AM
Quote from: Joe[e2] on October 12, 2005, 08:05:44 AM
MFC is, in my eyes, the CSB of the entire C++ language.

Damnit, stupid power outage, now I have to start over.

Joe, that's patently retarded.  That's like saying the Java class library, or java.lang.* and javax.swing.* are the CSB of the Java language; or the System and System.Windows.Forms namespaces are the CSB of the .NET Framework languages; or that wxWidgets is the CSB of cross-platform C++.

Most people's problems with MFC stems from its bloat.  If you're using only the Windows part of it (objects deriving from CWnd), you can't specify a way to exclude CSocket from the library, or vice versa.

Plus, MFC is an extremely effective teaching tool for learning the Windows API.  They don't try to hide the fact that it's a wrapper for the Win32 API.  For example, the CWnd class defines the method CWnd::SetWindowPos(const CWnd*, int, int, int, int, UINT), which wraps the Win32 API function SetWindowPos(HWND, HWND, int, int, int, int, UINT).  All the CWnd function does is provide the window handle to the first parameter of the API, and translates the 2nd parameter (a pointer to another CWnd) into a window handle.

Languages and language libraries exist so the developer doesn't have to constantly reinvent the wheel.  If MFC is the CSB of C++, next time, create your own windowing implementation for Java (don't use Swing).
Title: Re: [C++] Beginning socket use
Post by: Joe on October 12, 2005, 06:36:48 PM
man I feel stupid now =p
Title: Re: [C++] Beginning socket use
Post by: mynameistmp on October 17, 2005, 04:33:51 AM
You should read Beej's classic:

http://beej.us/guide/bgnet/