LINUX programming

Moderators: ITA
Number of threads: 1339
Number of posts: 2924

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How can I write code to start communication between two servers Posted by chhewang on 9 Jan 2011 at 7:29 AM
I want to create two servers that will communicate to each other as well as a client which will communicate with both of them.Can any one please suggest me how to get started...
Report
Re: How can I write code to start communication between two servers Posted by harryq on 9 Jan 2011 at 9:10 AM
That totally depends on what you try to achieve. Are you writing the programs running on these servers yourself? Is it business critical?

Suppose your applications are written in Java (not really needed, but makes things easier), and the data/communication is somewhat important, I suggest you use some kind of middleware. Using message middleware, you simply put messages with whatever content you want on a queue (hosted by a queue manager), the payload of the message can be XML, serialized java objects, binary or text. The receiver simply picks up the message from the queue with a simple API call. No need for messy TCP/IP code in your projects.

Active MQ (a queue manager, there are lots of brands) can be found here.
http://activemq.apache.org/getting-started.html

Here are some examples on how to use JMS to send and receive messages.
http://libzter.com/wiki/JMS


Then, if this does not suite you, then you can always go back to sending TCP/IP messages. That can be hard or easy. You probably want to use some framework if you have somewhat complex communication. Here is one framework, there are others, http://libzter.com/wiki/ACDK



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.