I have started learning c++ quite a while ago, and I am now starting to develop a program which uses a Chat file like this:
filename: (identity):(date)
contents: (identity):(message)
But the only problem I have is that I need to access and send this file over a network(A LAN created using Hamachi).
Do I need several libraries or something for this?
Can anyone give
tips on how to achieve this?
There is a lot of libraries which can help you:
very powerful from boost:
http://www.boost.org/doc/libs/1_48_0/doc/html/boost_asio.html
one from QTNetwork (ofc if you are using QT).
I recommend you to do not use Winsock etc you will be limited to a one platform only.
Related
I have been working on a project where I am interacting with a 3D camera(on a single machine) through its SDK written in C++. The extent of my knowledge in that language is just as good as what a basic crash course could teach. I need to provide an interface(web) which shows the camera preview from the SDK and when the capture image is clicked, I need to capture an Image using the SDK with a specified filename and path.
The approaches I thought of are:
Using NodeJS exec to capture images the compiled version(exe) of my program in C++. I am communicating the filepath and using json.
I could learn and use C++ CGI to simply control C++ SDK stuff.
Any help/suggestions would be greatly appreciated. Thanks in advance.
You can use one of the C++ CGI libraries out there but, as easy as they are to use, just calling an executable seems easier and cleaner. I think the scanner should come with a bundled tool to drive it, doesn’t it?
After years of no programming I am on my way to learn C++ on my Mac OSX. My eager goal is the creation of an algorithmic/automatic trading software for use with Interactive Brokers.
Now, I downloaded their API for Mac OSX and the docs. But I get the notion that the API for MacOSX is only for usage with Java?
I case I am wrong: I would be very happy if someone could help me with a few lines of C++ for usage on the IB-API, e. g. opening a session or loading marketdata for a security?
Btw, I did that with R and after having found some examples it was quite easy to use.
Thanks.
IB also provides the so called "Posix C++ API" which should work on MacOSX (It's stupidly included within the twsapi_unixmac_*.jar archive).
There is an autotools based project (twsapi) from this original IB code which builds fine on MacOSX, see
https://github.com/rudimeier/twsapi
A more exciting example of how to use twsapi in practice you may find in the twstools
project there:
https://github.com/rudimeier/twstools
Another wrapper directly around the C++ Posix version that compiles and runs on many platforms is TwsApiC++.
You can find it at https://github.com/JanBoonen/TwsApiCpp
It also includes some examples.
What to learn to be able to send files online using c++ on windows ?
i know c++, and i got a program that does some benchmark and saves into a text file, i want that text file to be sent to me after the benchmarking is done, so what should i search for ? tried searching found something called sockets and something about server and clients in linux, kinda dunno what to search for.
this isn't a homework, just want to do it for fun xD, and would help me in future if i want someone who knows nothing about whats happening to test something for me (the file would have all i need and it will be sent to me).
I think you better off just emailing the file after a benchmark is done, and doing it using some bash or Python scripting rather than C++ or any other low level language. Here is an example of sending email using Python. Another option would be to upload to the FTP or use rsync to transfer file over SSH. And in any case, do not write your own client-server application for this.
If you still want to use C++, here is an example of sending email using POCO.
you will find some official documentation on Win32 sockets here:
http://msdn.microsoft.com/en-us/library/ms738545%28v=vs.85%29.aspx
This tutorial seems pretty good and simple:
http://johnnie.jerrata.com/winsocktutorial/
Have a nice day!
My question is that create a IM software like MSN or Gtalk, to have the basic function using C++.
You can use any technology and libary to do that.
Can someone give me a suggestion?
I add that this not my homework. This
is my job question.
Because I am a fresh man in my
company.
So, they give me some questions to let
me dirty my hand.
My suggestion from experience with doing this sort of thing before is to find a library that implements Jabber also known as XMPP (Google Talk) for you. That way all you have to do is create the user interface. If you are working with Windows, MSDN has some great tutorials for creating user interfaces in C++. If you are using Linux, you will probably want to look for an X windows tutorial. Other than that, check out this link for a list of C++ libraries for Jabber/XMPP.
Good luck!
It sounds like you will probably want to use a library that already knows how to interface with existing IM clients. Google Talk, for example, uses the XMPP (also known as Jabber) protocol. The XMPP website has links to a number of free C++ libraries to communicate with other XMPP clients (like Google Talk):
http://xmpp.org/software/libraries.shtml
Here is one example of a GPL XMPP library for C++: http://camaya.net/gloox/
I was told I have to use winsock, but I dont know where to start. For example, I am trying to access, lets say http://www.newegg.com/, I am trying to get the text title of just the three front page products. Any help is greatly appreciated. :D
I'd also recommend libcurl for this sort of thing.
You can use the cURL command line tool to generate sample code as well, which is helpful for experimentation.
W3.org themselves provide sample C / C++ librarys for Http requests.
Find them here
Specifically, look for HTTPReq.c
Use boost library and poco. They both provide solutions for network programming. Boost also provide spirit library which you can use for parsing data from websites. Poco libraru also provides NetSSL, crypto solutions.
P.S. boost::spirit is not a library for parsing data from websites, it provides solution for parsing strings ...
you need to open a socket.
then you need to do an http get
somewhat like :-
http://www.esqsoft.com/examples/troubleshooting-http-using-telnet.htm
You could use the QNetworkAccessmanager class from Qt framework.
I'm assuming you need to use c++ for a reason, such as integration with existing software, otherwise, as per some of the other suggestions, choosing a language with a more convenient framework (eg: scripting language) would be better suited for the task.
If you would like to avoid getting your hands dirty with WINSOCK, or have the need to run on a platform other than windows, you could look at the using the boost asio library.
The following page contains links to simple sync and async http clients:
http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/examples.html
You can find documentation on the library itself at:
http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio.html
Use c++ if you must, but it might be a lot less painful to use python.
Look at the Python httplib module for how to set the host you want to pull from etc. Python's available for free for most platforms and is enough like C++ that you can probably learn python a heck of a lot faster than you can learn to write a program controlled browser in c++. Well, maybe that's not true for everyone on this site, but I'll bet it's true for "most" of us. I used to get stock quotes updated in near real time from CNN Money years ago and IIRC it was around 100 lines of python code.
Hotei