Cross-Platform Client/Server with a twist

Jul 25, 2010 at 10:43am
Hi,

I am new to the boards and have just started programming in C++, I have a project in mind and could do with some pointers or reference to get me on the right track. I think it is fairly ambitious so I may not have posted in the right section but I am a beginner. Basically, I want to create a console chat client/server program, however I need the Linux server to do the following...

1. Take input to specify the server address the client should connect to
2. Create a windows compatible client (the linux server MUST create the win .exe)
3. Listen for multiple connections, and be able to respond to incoming chat


Where do I start here? Is this possible? I have seen python and ruby programs run on Linux that can create windows servers so I am assuming it is doable but I'm not sure.

Also, I've not coded C++ on windows before, so what are differences when doing sockets?

Many thanks
Jul 25, 2010 at 11:46am
2. Create a windows compatible client (the linux server MUST create the win .exe)

What do you mean by that? Do you want the server to send a chat client as a windows executable file to the client?
Jul 25, 2010 at 12:01pm
No, I just need the Linux server to generate it, I'll pass the .exe to the user myself. So, say I start the server and feed in a command like so: "buildclient ip:port" The windows .exe client then gets output to a directory with the server parameters in-built. Then I could issue a command to chat, it would then listen for incoming connections and chat messages I could respond to.
Jul 25, 2010 at 12:58pm
If its only the ip address and port number then you could try to be crude but effective and simply do a string replace on an exe that was built on a Windows machine. That's pretty quick and dirty. I don't know much about EXE file format and it might be checksummed but if it isn't checked I don't see why that approach shouldn't work.

Otherwise you could try building a cross-compiler for Linux to generate windows executables. I know this is possible, but I don't know how tricky it is to set up.
Jul 25, 2010 at 1:16pm
I think it'd be best to use dns incase the server ip gets renewed, that way, I won't need to generate new clients for everyone. I've been advised on another forum to use the poco library for cross-platform development and it seems its up to the job.

With regard to the .exe creation I figured I could use the mingw cross-compiler. Store the client source in the server and when I issue the build command the function can be read and then passed to mingw along with the dns/port varibale to create the exe.

Sound good?
Jul 25, 2010 at 3:05pm
MinGW is the way to go, but there is no point to compile the source on the server if the host name is going to stay the same or if you make it configurable.
Instead of Poco, you could use boost, which is more widely used and also provides network functionality (Asio) among many things. Never heard of Poco before, although it doesn't seem too bad at first glance.
Jul 25, 2010 at 3:30pm
Thanks for the advice, I'll take a look at boost. The DNS is essential as there will be multiple servers, the server operator will need to specify their server address when creating the windows client for the user as the user would only have the option to connect to one server
Jul 25, 2010 at 3:33pm
You can just have the client read the server address from a configuration file.
Then the user can choose.
Topic archived. No new replies allowed.