IP address of current computer....

Jim Ault JimAultWins at yahoo.com
Fri Dec 8 16:30:30 CST 2006


On 12/8/06 1:08 PM, "David Bovill" <david at openpartnership.net> wrote:

> Something that I would like to clarify - if I want to get 2 way
> communication using datagrams do I need to have 2 servers on each machine
> and 2 pipes open - or can I send information back and forth both ways on the
> same datagram socket connection?

Basically

app1
write "message string, hello, there" to socket "112.122.22.33:4567"
--will do this and if there is an app at "112.122.22.33" listening on port
4567, it will receive the packet containing
<the sending IP, the socket, the message>


if app2 does
write "valuable data" to socket "112.122.22.99:4666"
-- need to have an app listening on port 4666 on the other computer located
at "112.122.22.99"

Provisions
Routers and firewalls have to allow the port traffic between computers
Only one app can receive packets on a single port number on the same
computer.
One app can listen to many ports on the same computer
--- example
open datagram socket 4567 with message "iGotPacketOn4567"
open datagram socket 5589 with message "iGotPacketOn5589"
open datagram socket 5600 with message "iGotPacketAsGeneralDelivery"
open datagram socket 5601 with message "iGotPacketAsGeneralDelivery"
open datagram socket 5602 with message "iGotPacketAsGeneralDelivery"
---
It is not, as you said, 'on the same datagram socket connection' but rather
when "app1 talks on which port is app2 configured to listen"

Five apps can talk to app1 if they use the IP address and the correct port.
app1 will handle the datagrams in the order received and the operating
system on app1's computer will queue them to be sent to app1 when it is
available.

Hope this helps you get a better handle on things.  It is a bit like a
parcel service that delivers to your door, if is has the correct address and
you are at home, listening for the door bell.

Jim Ault
Las Vegas





More information about the use-livecode mailing list