Solved

communication protocols

Posted on 2000-03-31
8
311 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
  • 4
  • 4
8 Comments
 
LVL 32

Expert Comment

by:jhance
Comment Utility
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
Comment Utility
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 300 total points
Comment Utility
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
 
LVL 2

Author Comment

by:yairy
Comment Utility
You more or less sumarized MY knowledge...
I realy need a breadther view.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 32

Expert Comment

by:jhance
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I'll give you the points,
but I'll feel free to ask some follow questions...

Yair
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now