Hi Serge,

No, you don't do this with the idle handler. You could create a button, which which accepts connections on a partular port. As soon as data is detected, a message is sent to the button, which triggers a handler. For example:

on mouseUp
  accept connections on port 1234 with message "foo"
end mouseUp

on foo theIP,theMsg
   beep
put "You recieved the message:" && quote & theMsg & quote && "from:" && theIP && "at" && the long time into fld "Received Messages"
   close socket theIP
end foo

On the client machine, you could create a stack with a button, containing the following script:

constant kSock = "192.168.0.1:1234"
on mouseUp
  open socket to kSock
  write "hello" to socket kSock
  close socket kSock
end mouseUp

This is a good way to start experimenting. Once this works, you could modify your scripts to keep the connection alive. You do this by reading from socket theIP with message "foo" again, instead of closing the socket. However, you need to make sure that the socket is closed if the client gives a signal to do so.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum

We are always looking for new projects! Feel free to contact us to discuss your custom software project!

On 1 feb 2009, at 14:18, Serge Brami wrote:

I want to create une simple Chat application between 2 users in a LOCAL NETWORK

For that I create 2 stacks  one  for each user


I create fields to store the messages to be sent and to be received
I create controls to Open and close socketsocket

I can create control  to write to socket  (for sending messages)

But How to receive the messages ?
Yes i can create a button for reading from socket , but I want to receive automatically the messages that have been sent

It would be possible using an Idle handler ( on idle ,read from socket -end idle) but this would slow down my application

Is there another way

Thanks for help


Serge BRAMI

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to