Best way to communicate over net?

  • Thread starter Thread starter MrQuan
  • Start date Start date
M

MrQuan

G'day all,

I have a requirement to communicate between two or more PCs over the
Internet, however I have no idea how to go about this.

I'm not talking about a chat programme as such, I want to have an
application running 24/7 on a 'base PC' connected to the internet that
can send out data (like a monitoring application). It's not designed
for chatting, but sending data used by my application (this can be in
the form of a binary file or xml or whatever).

I then want to have any other 'field PC' with my app and the right
username and password to be able to recieve this data live, and send
data back. I would also like to save all outgoing and incoming data on
the 'base PC' to a log of some sort on the Internet. I have a website
host (at host monster), if that helps? Perhaps it could log the data
there?

I don't want to have to play around with static IPs, just install my
app on the 'field PC' enter the right Username and Password in the
settings, and off it goes.

My initial thought was ftp, reading and writing data files, but it will
need to be faster than that - and I need it to recieve data instantly
(not scanning an ftp directory on intervals).

I hope I have explained myself well. Can anyone please suggest the
best method to use?

Many thanks,
MrQuan
 
Hello,

You have mention that you don't want to worry about static IPs, but the
server computer, aka 'base computer', has to have some static location on the
internet where clients know where to find it. Your hosted website has a
static IP you could use and use web services to either perform all the
functionality of server client communication, where your asp.net web service
enabled website becames essentially the server you are looking for.

You can also use 'Network Streams', new to .Net 2.0, to communicate from
your server application to your clients application. This is not going to be
a secure as using asp.net web services, but it is an option. Most likely your
best bet is to keep the data and server functionality on a secure web server
and interface your application through web methods, turning your application
into a smart client. A less secure situation would be to store a client IP
registration on a web server, whereas the web server keep tracking on client
IPs, but network communications are peer to peer, through network streams and
only uses the server to get the current IPs of the client applications.

Another thing I would look into is .NET 3.0 release of Windows Communication
Foundation, WCF. Here is an article on that,
http://msdn.microsoft.com//msdnmag/issues/06/10/PeerToPeer/default.aspx

Hope that helps.
 
just use a database you ****ing retard

you can replicate over the internet; you can support disconnected
clients

-Aaron
 
Use a dynamic dns service if you dont want to work about IP's. Try
"no-ip.com".

The Grand Master
 
I'm not sure a database will be approapriate, I need to sent many
packets of data and images at times.

Besides I would need to constantly check the database for changes - as
I stated in my initial post this is not what I wanted to do.

By-the-way, your language isn't appreciated, but I known from other
threads you're a tool - so I'll leave it at that.
 
Thanks for the reply,

I agree about the web server being a central point, due to it's static
IP. I'm currently looking into your suggestions. I don't have the
technical know-how to just whip up what you're suggestion, this is a
new field for me, but I'm sure you've given me a good place to start
looking.

MrQuan
 
Well i would do this with a webservice

Another way could be to use remoting however i feel that the web is more
suitable for Webservices as i only use remoting in a managed environment

regards

Michel Posseth [MCP]
 
I would choose a raw method of transfer over a web service. Sounds like
you need to send binary files, the xml element of a web service will
only add a load of wastefull xml bloat to the payload. Also web
services are not "push", a client app would need to constantly poll to
see if there were updates available on the sever. Sounds like you need
push not pull. I recon you need to model it on a chat app and just add
the ability to send the binary files - try base64'ing the binary files
then send the string as text - unpacking it back to a binary again file
at the other end.

The Grand Master
 
and btw; have you ever looked at a database?

for the record SQL Server has 'native HTTP endpoints'

and all of this DOTNET crap you talk of; it isn't truly multi-user,
multi-instance

SQL Server has things like 'round robin' so if you've got 4 people
reading from a table; it's actually FASTER

-Aaron
 
Aaron,

You have admitted that someone other than yourself is right? This is very
good. It's the first step along the road to recovery.

Bruce
 
I've been searching around and ended up finding this...

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3028&lngWId=10

It's a chat app based on a php server and mysql database. Being a chat
app, it's push, as you suggested. But also has the added benefit of
saving all message data to the mysql database (as Aaron so politely
mentioned earlier). It works quite well from my initial testing with
only a second or two lag, however as you suggest I need to develop
support for binary files, which I'm working on now. I'm also
streamlining the messages (taking out richtext, etc), so hopefully this
will be suitable for my application.

Many thanks,
MrQuan
 
Sounds cool. You could base64 encode the file before sending it. Or you
could use yEnc - this allows you to encode the file before sending -
then decodes the file at the other end, and then does a checksum to
ensure that the entire file has arrived intact. Either of these methods
will allow you to send the file across the internet as a text string.

You may want to consider compressing the binary file first before
encoding it, to reduce the size. There are a number of open source
compression tools that you can use. Below is a link to some source code
that has been ported to a number of languages including PHP, Java, C#
etc etc. It includes a routine for compressing and decompressing using
the LZ77 algorithm. It was developed for compressing XML files being
downloaded by a flash app - but can also be used for what you are
doing.

http://www.strille.net/tutorials/FlashXMLCompressor/index.php

Good luck
The Grand Master
 
Back
Top