
07-26-2012, 09:40 AM
|
 |
Underclocked lifestyle
Forum Leader * Guru *
|
|
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,193
|
|
|
Communication over the Internet can be more complicated than via local networks for a number of reasons. First you have to consider getting through firewalls. Next you have the issue of "finding" the "other end" when establishing communication. Then you have to consider that end-to-end communications will be both slower in throughput and in latency. Finally you'll find that it isn't as reliable as a local network and connections can fail for a number of reasons.
There really isn't a "simplest" solution. It depends on what you mean by "simplest" really.
You might mean something like "fewest lines of code" which if you are writing both ends of the communication has a different answer than if one end is a pre-made stadnard type of server or client. If you are writing both ends then using MSMQ Prinate Machine Queues might be called "the simplest."
However "simplest" might mean the one where you have the fewest concepts to learn and the least administrative setup to run. While the MSMQ approach is only a few lines of code few casual plinkers know anything about using it or setting it up.
Usually you'll get suggestions on how to use "bonehead TCP" with Winsock controls. This quickly turns into the topic of layering a message protocol on top of TCP since it is not message oriented, but a stream. You get here as soon as you find you are losing data or having your programs lock up when you write them to naively assume 1 send = 1 receive.
You can also get into trouble if your "serial port" (probably MSComm based) code is written naively. If you have any DoEvents calls in your program that's a big red flag that you are doing things incorrectly, which will impede adding Internet connectivity. Fix this first. Paraphrasing Obi-Wan: "Use the Events, Luke!" (in this case OnComm).
Beyond that further discussion is almost pointles. This sort of introductory information has been covered so many times that a simple search of the Web should return thousands of hits. Sadly separating the wheat from the enormous volume of chaff is quite a chore, since there is so much poor advice and poorer examples out there.
|
|