954,504 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

General Client-Server model query

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

darelet
Newbie Poster
19 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 
sundip
Junior Poster
104 posts since Aug 2010
Reputation Points: 14
Solved Threads: 24
 

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.

L7Sqr
Practically a Master Poster
657 posts since Feb 2011
Reputation Points: 201
Solved Threads: 124
 

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..

darelet
Newbie Poster
19 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 

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.

darelet
Newbie Poster
19 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 
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.

NicAx64
Posting Pro
536 posts since Mar 2009
Reputation Points: 86
Solved Threads: 44
 
You can write some simple function like this.

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

L7Sqr
Practically a Master Poster
657 posts since Feb 2011
Reputation Points: 201
Solved Threads: 124
 

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

darelet
Newbie Poster
19 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: