Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

communication protocols

Posted on 2000-03-31
8
Medium Priority
?
350 Views
Last Modified: 2010-04-02
I have a general question:

My application needs to connect with a server threw the internet and exchange some information with it.

There are many protocols to do it.
Can one give me a short review
on these protocols, their advantages
and disadvantages.

more then that, could one link me
to some basic source code in C++.

Yair
0
Comment
Question by:yairy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 2673420
Since you are going via the internet there is really only one choice available, TCPIP.

Other protocols which are commonly used (on Windows at least) are NetBEUI and IPX.  Most internet routers don't pass IPX and NetBEUI is non-routable.  This means that it will only work on a local subnet.

Beyond this, you've really provided too little information about what kind of connection you need to make and the type and amount of data you need to pass.
0
 
LVL 2

Author Comment

by:yairy
ID: 2676883
Maybe I wasn't too clear...

I want my application to connect with
a server and exchange some information
with it.

known protocols / approaches are
sockets, COM, DCOM, finger.... and many more.

I wouldn't know what to choose.
I whould also like some ref to a source code example.

Thanks...



0
 
LVL 32

Accepted Solution

by:
jhance earned 1200 total points
ID: 2677389
You're _STILL_ being unclear and you are lumping several things together as "protocols" which are not:

sockets - a programming interface used to write a program to communicate via TCPIP

COM - an binary object specification

DCOM - COM extended to support multiple computers.

finger - a service which is most commonly found on unix boxes which provides information about users.

Again, you said you needed to connect via the internet.  That implies TCPIP protocol.  There are no other choices.  

To accomplish that connection, you will need to use the sockets programming library.  Again, there are no other choices since you must use TCPIP.

Once you have a connection via a socket, the format of the actual data exchanged (what you are calling protocol perhaps) is entirely up to you since you are implementing both the client and the server.

It's only when you need to connect to or receive connections from an established service or client that you need to adhere to a particular data "protocol".  Examples of this would be POP-3, SMTP, and HTTP.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 2

Author Comment

by:yairy
ID: 2682237
You more or less sumarized MY knowledge...
I realy need a breadther view.
0
 
LVL 32

Expert Comment

by:jhance
ID: 2682357
Well unless you provide more details about what you're trying to do, what been said is about all I can offer.

This is like you saying how can I get from New York to Chicago?  

Well, you can drive a car, if you had one.  You could fly if you had the money and were in a hurry.  You could ride a bike if you were not in a hurry and looking to get into shape.   You could take a train....etc.  

But it's all speculation until you say, "I've got an important meeting to attend tomorrow morning and I can't leave until after 6 p.m. tonight.  

That really narrows down the possible solutions, doesn't it?
0
 
LVL 2

Author Comment

by:yairy
ID: 2682402
a) I want my utility, after being intalled, try from time to time to see if the internet connection is on at the customers computer.

b) If so, it will connect with a known server and ask it if there is a new version of the product (is a flag True...)

c) If so, it will prompt the user
with a choise to download the new
version.

d) downloading will take place.


Clearer ?
0
 
LVL 32

Expert Comment

by:jhance
ID: 2683207
Yes, much clearer.

For what you've suggested, I'd recommend using HTTP.  It's simple, universally supported, and likely to be compatible with existing networks, proxies, firewalls, etc.

If you are running this on Windows, the CHttpConnection class in WININET makes this incredibly easy from a programming point of view.

Here is a sample of code that does almost exactly what you are wanting to do.  It opens a page on the server called update.htm, reads the version available there, if it's up to date, it says so, otherwise it opens a browser window and downloads the new version.  



CInternetSession sess;
      try{
            CHttpConnection *pHttpConnect = sess.GetHttpConnection(_T("www.UPDATESERVER.com"));
            CHttpFile *pFile = pHttpConnect->OpenRequest(CHttpConnection::HTTP_VERB_GET, _T("/update.htm"));
            pFile->SendRequest();
            pFile->QueryInfoStatusCode(dwStatus);
            if(dwStatus == 200){
                  // All is OK

                  while(pFile->ReadString(msg) != NULL){
                        // Find the latest version available
                        if(msg.Find(_T("Version: ")) > 0){
                              start = msg.Find(_T("Version: "));
                              finish = msg.Find(_T("</p>"));
                              updatedVersion = msg.Mid(start + 9, finish - (start+9));
                        }

                        // Find the URL of the latest version
                        if(msg.Find(_T("URL: ")) > 0){
                              start = msg.Find(_T("URL: "));
                              finish = msg.Find(_T("</p>"));
                              updatedURL = msg.Mid(start + 5, finish - (start+5));
                        }
                  }
            }
            pFile->Close();

            // If it's newer, ask to download it...
            if(updatedVersion > currentVersion){
                  if(AfxMessageBox("Your copy of NetSwitcher is out of date...\nAn UPDATE is available, click OK to download...\nor Cancel to download later", MB_OKCANCEL) == IDOK){
                        ::ShellExecute(NULL, "open", (LPCTSTR)updatedURL, NULL, NULL, SW_SHOWNORMAL);
                  }
            }
            else{
                  AfxMessageBox("Your copy of the software is up to date!", MB_OK);
            }

      }
      catch(CInternetException *pEx){
            pEx->ReportError();
            pEx->Delete();
      }
0
 
LVL 2

Author Comment

by:yairy
ID: 2695842
I'll give you the points,
but I'll feel free to ask some follow questions...

Yair
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question