Hi all,

I need a setup involving a client or front-end program that sends some tasks to a back-end process for processing and collects results for output. I know this involves socket programming, but one issue here is that the front-end is a windows program and the back-end is a linux cluster server. Converting the front-end to linux would take too much effort considering I've used some windows functions for convenience. So my question is, how do I implement this? What libraries should I use for both setups? Is the socket programming API standard and therefore cross-platform?

Thanks

There is nothing preventing you from opening a socket on your windows machine and connecting to a linux machine on the other end. If you want a good introduction to the topic (for both windows and linux) you can search for Beej's guide to networking.
There are also third-party libraries that make this more-or-less a non-issue. Boost, for instance, has libraries for this.

Thanks guys for the speedy and optimistic response. Those third party tools would be glorious as delving into socket programming subtleties would be digressing from my core focus especially given the short time period I need to do this. I've got Beej's guide and am currently checking out Socketlib. Will definitely be back if I run into non-googleable issues..

Hello again,
I found those third party tools too complex and decided to just use the winsock default libraries. Someone tell me, why is not sending of float/double arrays rarely covered in send() operations? It seems like most examples that I see just cover text based (telnet like) operations. I want to share float data between various network nodes and it doesn't look that straight-forward.

I want to share float data between various network nodes and it doesn't look that straight-forward.

You need the help on data representation right ?
the answer is all the networking protocols are using a big-ending method to
store data. But formats like IEEE754 won't be change platform to platform.
so go ahead and convert them to big-ending from little ending. You can write
some simple function like this.

void* little2bigend_32(void *data)
{
    for (int i=0;i<2;i++)
    {
        unsigned char temp = static_cast<unsigned char>(data[i]);
        data[i] = data [3-i];
        data[3-i] = temp ;
    }

}

however when we use a format like XML we don't need to deal with this either.

You can write
some simple function like this.

Or you can just use ntoh* and hton* (references).

ntoh and hton deals with int data if I'm not wrong! @Nicax64, your example is too vague to implement. Where do I fit it in (assuming I need to send a 900x700 float array)? I'd also appreciate general advice on the best way around this whole issue.. Let me rephrase my situation..

--------------------------------------------------------------------------------
I need to do some computationally expensive mathematical-based tasks (like calculating Hu moments and central moments) on large float arrays over a cluster of computers controlled by a linux running server (which is the back end).
I need a windows front-end for display of results in a graphical manner, as well as acquisition of the float array inputs...
----------------------------------------------------------------------------

NB: Any simpler but decent libraries (besides boost and socketlib) you guys know about? I have a feeling I might have to resort to that ultimately

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.