ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have been programming in C++ for a short period of time now, under Ubuntu, with the g++ compiler.
I recently tried starting network (sockets) programming and I am finding the subject very obscure and confusing. All the tutorials, references, and examples I come across for C++ programming always seem to have plain C code, with hardly, if any C++ (such as using the <iostream> header, instead of C's, <stdio.h>). I am finding it difficult to implement C code into C++ code, and because of this, I am not sure where to start, and I surely don't want to start on the wrong foot.
Now, I am not asking you to answer every question about sockets programming known to man, but just this. Is there a specific library/method of programming for writing sockets in actual C++ code, or will I just have to work with writing mixed C/C++ code (or possibly just C)? I am very set-in to the way of coding habits/structure/syntax for C++, and I just want to know if what information I am finding is just the way it is - meaning I will have to mix code, or just code in C - or is there something I'm missing. I want to code in C++ because in terms of buffer overflows and other unnoticed syntactical errors that can be exploited, C++ sounds to be a lot safer.
Please, if you could, also post helpful resources on this subject, or the subject of sockets (done in C++).
Note, though, that I've already looked at Rob Tougher's tutorial, and I cannot seem to get it to compile. If you can, any help with this is also appreciated, as it is also a relevant answer to this question.
I'm not a C++ coder, so can not really help you. But isn't it a matter of simply using the standard socket functions in your class? And everytime you encounter something that requires standard C stuff (e.g. printf), replace it with the C++ counterpart?
If you need help with last part of your question, please post relevant code and compile errors ("can't seem to get it to compile" does not give us much to go on).
(bigearsbilly) -> I really like the look of boost, and
(Tinkster) -> Thanks for showing me that, as I didn't know
that the qt library also had support for sockets. Thanks
very much for enlightening me, as I have proved I'm a total
"noob" in C++