Hi Xavier,  here is the script i have learned and
modified from a lot of what have been posted
previously on this list.  This is a great list with a
lot of kind, cooperative helpful people.  hope you can
use it somehow.  it works on a one machine(client) to
a server test.  haven't tried with more than that. 
let us/me know if you try it with more.  (can anyone
show how to do this with more than one open socket?)

Here's how it works:
The client send some data/text to the server, and get
the message that the data has been/has not been
received at certain time of the day.  At the same
time, the client will get to see back almost
immediately the latest update of data on the server.

The server reads/accept the the data/text that is sent
by the client.  What you do/process with the data/text
is up to you then.  It sent the latest update back to
the client just to show that the new data has been
added.

Here's the script: 

on the client side:

on mouseUp
  open socket to "1.1.1.1:8080" with message gotcha
  --change 1.1.1.1 to the appropriate server address
end mouseUp

on gotcha s
  put field "a" into var1 
  (--text to be sent to server)
  write var1 & crlf & (the long time) to socket s
  
  (--reading feedback from the server)
  read from socket s until empty 
  put it into field "b"
  
  if last line of field "b"  = "RESULT OK"&&the date
  then
    put "Data sent successfully at:."&the long time
after the last line of field "b"
    put "Looks like we are online at"&&(the long time)
  else
    answer "Looks like the server is not responding."
  end if
  close socket s
end gotcha



On the server side:

on openCard
  accept connections on port 8080 with message
"newconnect"
  if the result is not empty then put the result
  checkData
end openCard

on checkData
  put field 1 into field "b"
  send "checkData" to this card in 1 seconds
end checkData

on newconnect s
  read from socket s until empty
  (--text sent from the client)
  put it into fld 1 
  put field 1 into var2
  write var2&cr&cr&"RESULT OK " && the date to socket
s
  (--to show back to the client the latest update sent
   to the server)  
close socket s
end newconnect

feel free to add/modified and it will be great if it
can be posted back to the list.

cheers.-rosli

__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to