Solved

communication protocols

Posted on 2000-03-31
8
322 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
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 300 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

770 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