I have some experience on Matlab, Java and C++, but fot the type of programming I'm trying to do here, I'm basically a beginner.
Eventually, the main idea of this Server/Client is that the client will ask the server for time, receive the time, read the string
and sync its time to the server, assuming there is a time drift.
As of right now I have the server in Java and a client in Java that work. They are not syncing yet, but the client makes a request to
the server, which sends a string with the date and time and the client prints that string. We don't need the time sync part quite yet.
More importantly is to create a client on C++ that does the same that the one on Java does (I'll post both codes soon) and works with the Java server.
On the C++ side, I got a simple client/Server program and I'm trying to change the client enough so that it works with the Java server.
My 1st problem is that because this C++ client was written a while ago, the Visual C++ 2010 is saying that the project is out of date.
I tried reading through forums for help with that and each was very specific to each case. I tried a few things suggested, but still no luck.
Below I'll post the C++ client and later I'll post the Java server/client.
Anyone interested in helping me out with this? It'd be much appreciated, I've done stuff on C++ but nothing like network sockets, so I'm a little confused.
Wow, no replies, hope people start looking at this thread
Anyway, the first thing I did was to change the host port since the Java application was using the port "1234", so I changed it to that.
Next, I added a piece of code to find the computer's IP address and use that instead of the internal IP (127.0.0.1), because the Java client (will run parallel to the C++ client) has at the beginning a part where it looks for the IP.
----------------------
The problem is still the same though, because this code is oldish, when I try to run it on VC++ 2010, it says that the code is out of date and I can't figure out how to get around that, so I can't check to see if the alterations work. Any ideas on how I can get rid of this msg and run the code? I tried suggestions from people that had the same problem, but none of them worked, I think it's a problem more particular to this code itself. Any suggestions?
This is not C++ code, it's C code. What's worse, it's shitty C code.
You either should try to compile it with a C compiler or look for a C++ code snippet.
Hi,
it should be no problem to compile c-code with a c++-compiler and most of the commands for the sockets are still used so i don't know why it doesn't work.
But I've written a new socket class in c++, it isn't fully completed, but it should be enough for your problem. I've written a short example of a http-client using that class, that you can understand how it works. I hope it solves your problem:
"This is not C++ code, it's C code. What's worse, it's shitty C code.
You either should try to compile it with a C compiler or look for a C++ code snippet."
That explains a lot, however, I'd still expect it to compile in VC++ 2010. I'll look for better code.