Log in

View Full Version : TCP/UDP client server


sindarela
Mar 12, 2009, 04:48 AM
Hello sir,

I have a few questions to ask about TCP/UDP

1)how to write in c++ program to show the communication using socket TCP for synchronous communication and UDP for asynchronous communication for the simple client server program.

2) A simple application that uses RPC or RMI for the communication between a client to a server and a server to a server

Client <--->Server1 <---> Server 2

3) The invocation in server 1 to server 2 can have two types which are single thread and multithread.

4) How to compare the processing time and turnaround time for the above applications.


Thank you~:)

Perito
Mar 12, 2009, 05:31 AM
Your question is very involved - much too involved for a simple explanation here.

There are many places to find complete programs to show communication like this. Here's one on CodeProject.

CodeProject: Multi-threaded Client/Server Socket Class. Free source code and programming help (http://www.codeproject.com/KB/IP/serversocket.aspx)

There are many others on Code Project. Just search on "TCP UDP" or possibly on "sockets" or "winsock".

SourceForge.net also has a number of programs, including source code, that do this type of thing.

SourceForge.net: Open Source Software (http://sourceforge.net)

sindarela
Mar 12, 2009, 08:25 AM
Thanks for the helping sir,

Urm... how about d RMI or RCP?can u teach me how to write a simple application that uses RPC or RMI for the communication between a client to a server and a server to a server?

Perito
Mar 12, 2009, 08:33 AM
I'll confess that I've never used RMI at all.

A couple of links for RPC (in C++):

CodeProject: Introduction to RPC - Part 1. Free source code and programming help (http://www.codeproject.com/KB/IP/rpcintro1.aspx)

CodeProject: Introduction to RPC - Part 2. Free source code and programming help (http://www.codeproject.com/KB/IP/rpcintro2.aspx)

For RMI:

CodeProject: RMI for C++. Free source code and programming help (http://www.codeproject.com/KB/threads/RMI_For_Cpp.aspx)

sindarela
Mar 13, 2009, 05:54 AM
Thanks a lot sir for the information.. but I still have some problem to compare between communication server to server and comparison between communication time and turnaround?

Perito
Mar 13, 2009, 12:35 PM
I think that you're going to have to do some research to see which is the faster. You might have to do it empirically (write two applications and test to see which is faster).