Page 1 of 1

comunications between two programs

Posted: Sat Aug 16, 2008 10:59 am
by NummerDertien
Hi, i want to create a program wich can send a question to a other program this should use parameters but the program shuold response to the program wich asked the question and it shouldn't be necessary to restart the first program. All this should be done over the internet.

so i need a way to let two programs communicate over the internet without restarting the programs

pleaseeeeeeeeee help

Posted: Sat Aug 16, 2008 12:34 pm
by BvG
there's two approaches to communicate over the internet.

One is to set up a server somewhere, which the two programs use to communicate over. The advantage is, that on the two computer with the programs don't need to change any firewall or router settings. Of course you'll write a third application for the server, which can be hard to do, depending on the chosen technology. A slightly modified version of this makes one of the programs itself the server, so that you only need to care for firewalls etc. on one side.

The second way is the so called peer to peer (p2p) communication. This normally makes both your programs a client and a server at the same time. Advantage is of course the lack of yet another computer for the server, which might be down or unreachable at some inconvenient point.

As for actual technology, again this depends on your needs and knowledge. The easiest way is to use an existing protocol, which you know well and is easy to use in Rev. For example ftp or http, to a smaller extend xml-rpc when you are using a server. For p2p, you'd most likely want to use sockets directly, because then you don't need to build a http or ftp server within Rev.

There's many examples of servers, clients and peers on revOnline. of course there's also chatrev (see signature), but that one has evolved much and become a bit complex, so it might not be a good starting point for you.

Posted: Sun Aug 17, 2008 8:57 am
by NummerDertien
well i tried the connection with sockets but i don't understand that much of it so i first tried it on my own computer without anything over the internet but i just can't open the socket without getting error message 10061 i used this code:

Code: Select all

on mouseUp
  put ":999" into y
  put hostName() into x
  put hostNameToAddress(x) into x
  put first line of x into x
  put y after x
  if x is among the lines of openSockets() then
    put "socket: " && x && " already open..." into the last line of field "diag"
    close socket x
    if x is not among the lines of openSockets() then
      put "socket: " && x && " closed" into the last line of field "diag"
    end if
  end if
  open socket to x with message "SOpen"
end mouseUp

on socketError pAdata, pEdata
  put pEdata && pAdata into the last line of field "diag"
end socketError

on SOpen
  put "socket open" into the last line of field "diag"
end SOpen
did i do something wrong?